Skip to content

Commit

Permalink
Merge pull request #28 from bassfinity/27-containerized-the-applicati…
Browse files Browse the repository at this point in the history
…on-for-use-in-kubernetes

Fixes Containerized the application for use in Kubernetes #27
  • Loading branch information
markjacksonfishing authored Dec 11, 2024
2 parents 6d7ce63 + 2335638 commit 3b21b3a
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 10 deletions.
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Use an official Python image as the base
FROM python:3.9-slim

# Set environment variables to ensure Python behaves well in Docker
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

# Set the working directory in the container
WORKDIR /app

# Install system dependencies for Python and the app (e.g., build tools, if needed)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*

# Copy only the requirements first for efficient Docker caching
COPY requirements.txt /app/requirements.txt

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . /app

# Expose the application's port (adjust if needed)
EXPOSE 5000

# Health check to ensure the app is running
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl --fail http://localhost:5000/health || exit 1

# Default command to run the application
CMD ["python", "app.py"]
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,76 @@ This module uses solunar theory to recommend the best times for bass fishing.

---

Here’s an updated version of the `README.md` with Docker-specific instructions included:

---

# Solunar Bass Forecasting Tool 🎣

[![UptimeRobot status](https://img.shields.io/badge/status-up-green.svg)](https://stats.uptimerobot.com/AQLeOzd84C)

![SolunarBass](assets/solunarbass.png)

Welcome to **Solunar Bass**, an open-source project by **Bassfinity** that helps bass fishermen maximize their fishing success using solunar theory, data acquisition, and personalized recommendations. This repository powers a web app that predicts optimal bass fishing times based on solunar data, weather conditions, and location. You can view the website [here](https://solunarbass-h9jxdwh8usuzhpix2yessm.streamlit.app)

---

## New: Run with Docker 🐋

You can now run the Solunar Bass Forecasting Tool using Docker. Follow the steps below to build and run the Docker container.

### Prerequisites

- Install [Docker](https://docs.docker.com/get-docker/) on your system.

---

### Run the Application Using Docker

1. **Pull the Prebuilt Image**
The Docker image is available on Docker Hub. Pull it using:
```bash
docker pull anuclei/solunarbass:latest
```

2. **Run the Container**
Start the container and map the appropriate ports:
```bash
docker run -p 8501:8501 anuclei/solunarbass:latest
```

3. **Access the Application**
Open your browser and navigate to:
```
http://localhost:8501
```
---
### Build the Docker Image Locally (Optional)
If you want to build the image yourself:
1. **Clone the Repository**
```bash
git clone https://github.com/bassfinity/solunarbass.git
cd solunarbass
```

2. **Build the Image**
Use the following command to build the Docker image:
```bash
docker build -t anuclei/solunarbass:latest .
```

3. **Run the Container**
```bash
docker run -p 8501:8501 anuclei/solunarbass:latest
```
If you just perfer to pull the image from docker hub, you can use the following[image](https://hub.docker.com/repository/docker/anuclei/solunarbass/general)

---

## Contributing

Contributions are welcome! If you want to contribute to the project, follow these steps:
Expand Down
2 changes: 0 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# app.py

import streamlit as st
from datetime import date, datetime
from streamlit_js_eval import streamlit_js_eval # For geolocation
Expand Down
2 changes: 0 additions & 2 deletions src/data_acquisition.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# src/data_acquisition.py

import os
import requests
import streamlit as st
Expand Down
2 changes: 0 additions & 2 deletions src/data_processing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# src/data_processing.py

from datetime import datetime

def process_solunar_data(data, date_str):
Expand Down
2 changes: 0 additions & 2 deletions src/recommendation_engine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# src/recommendation_engine.py

def generate_recommendations(major_times, minor_times):
recommendations = []

Expand Down
2 changes: 0 additions & 2 deletions src/solunar_calculations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# src/solunar_calculations.py

from datetime import timedelta

def calculate_major_minor_times(solunar_data):
Expand Down

0 comments on commit 3b21b3a

Please sign in to comment.