Add Dockerfile and docker-compose.yml for deployment
This commit is contained in:
31
.dockerignore
Normal file
31
.dockerignore
Normal file
@@ -0,0 +1,31 @@
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
.Python
|
||||
env
|
||||
venv
|
||||
.venv
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
.tox
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.log
|
||||
.git
|
||||
.mypy_cache
|
||||
.pytest_cache
|
||||
.hypothesis
|
||||
.DS_Store
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
data/*.db
|
||||
data/*.db-*
|
||||
data/*.db-journal
|
||||
@@ -8,5 +8,8 @@ SECRET_KEY=replace-with-a-random-64-char-hex-string
|
||||
# Set to true to skip real AVConnect calls (for testing)
|
||||
# MOCK_AVCONNECT=true
|
||||
|
||||
# Port configuration
|
||||
APP_PORT=8000
|
||||
|
||||
# Database path (default: ./data/gates.db relative to project root)
|
||||
# DATABASE_URL=sqlite:///./data/gates.db
|
||||
|
||||
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# Use Python 3.11 slim image
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies if needed
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the source code
|
||||
COPY src/ ./src/
|
||||
COPY data/ ./data/
|
||||
|
||||
# Create data directory if it doesn't exist
|
||||
RUN mkdir -p data
|
||||
|
||||
# Expose port
|
||||
EXPOSE $APP_PORT
|
||||
|
||||
# Run the application
|
||||
CMD ["python", "-m", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "$APP_PORT"]
|
||||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
environment:
|
||||
- ADMIN_USERNAME=admin
|
||||
- ADMIN_PASSWORD=changeme
|
||||
- SECRET_KEY=supersecretkey
|
||||
- MOCK_AVCONNECT=false
|
||||
- APP_PORT=8000
|
||||
restart: unless-stopped
|
||||
Reference in New Issue
Block a user