diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9cd4c37 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,48 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*.so + +# Virtual environment +venv/ +env/ +.venv/ + +# Python egg metadata +*.egg-info/ +*.egg + +# Pip environment +pip-log.txt +pip-delete-this-directory.txt + +# pyenv +.python-version + +# VS Code settings +.vscode/ + +# MacOS / Windows system files +.DS_Store +Thumbs.db + +# Git +.git/ +.gitignore + +# Docker files +Dockerfile +docker-compose.yml + +# Logs +*.log + +# Compiled files +*.out +*.o +*.a +*.log + +# Build artifacts +build/ +dist/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9815835 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Use official Python 3.11 base image +FROM python:3.11-slim + +# Set work directory +WORKDIR /app + +# Install dependencies +COPY requirements.txt . +RUN pip install -r requirements.txt + +# Copy project files +COPY . . + +# Expose port +EXPOSE 80 + +# Run the FastAPI app with uvicorn + +CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "80"] diff --git a/README.md b/README.md index 478661f..ccc7021 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,20 @@ It connects to a Grow a Garden WebSocket to receive real-time updates and expose uvicorn main:app --host 0.0.0.0 --port 80 ``` +## 🐳 Run with Docker (Optional but Recommended) + +You can run this API using Docker to avoid setting up Python and dependencies manually. + +### 📦 Using Docker Compose + +This method builds and starts everything with one command: + + ```bash + git clone https://github.com/Liriosha/GAGAPI.git + cd GAGAPI + docker compose up --build + ``` + ## 🤝 Contributing diff --git a/api/__init__.py b/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f7ad3b5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3.9" + +services: + gagapi: + build: . + container_name: gagapi + ports: + - "80:80" + restart: unless-stopped diff --git a/api/requirements.txt b/requirements.txt similarity index 100% rename from api/requirements.txt rename to requirements.txt