aligned docker files
This commit is contained in:
+13
-5
@@ -7,7 +7,8 @@ ENV PYTHONUNBUFFERED=1 \
|
|||||||
PIP_NO_CACHE_DIR=1 \
|
PIP_NO_CACHE_DIR=1 \
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||||
UV_PROJECT_ENVIRONMENT=/app/.venv \
|
UV_PROJECT_ENVIRONMENT=/app/.venv \
|
||||||
ENVIRONMENT=production
|
ENVIRONMENT=production \
|
||||||
|
DATA_DIR=/data
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -18,14 +19,18 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|||||||
# Copy dependency files
|
# Copy dependency files
|
||||||
COPY pyproject.toml README.md ./
|
COPY pyproject.toml README.md ./
|
||||||
|
|
||||||
# Install Python dependencies
|
# Copy application code
|
||||||
RUN uv sync --no-dev
|
COPY src/ ./src/
|
||||||
|
|
||||||
|
# Install Python dependencies including all optional dependencies
|
||||||
|
# This makes the image self-contained and ready for any configuration
|
||||||
|
RUN uv sync --no-dev --all-extras
|
||||||
|
|
||||||
# Add virtual environment to PATH
|
# Add virtual environment to PATH
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
# Copy application code
|
# Create data directory for SQLite database
|
||||||
COPY src/ ./src/
|
RUN mkdir -p /data && chmod 777 /data
|
||||||
|
|
||||||
# Add healthcheck
|
# Add healthcheck
|
||||||
HEALTHCHECK \
|
HEALTHCHECK \
|
||||||
@@ -39,6 +44,9 @@ HEALTHCHECK \
|
|||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# Declare volume for persistent data
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
# Set entrypoint to restrict usage to uvicorn with this specific app
|
# Set entrypoint to restrict usage to uvicorn with this specific app
|
||||||
ENTRYPOINT ["uvicorn", "src.baby_monitor.main:app"]
|
ENTRYPOINT ["uvicorn", "src.baby_monitor.main:app"]
|
||||||
|
|
||||||
|
|||||||
+19
-2
@@ -1,5 +1,3 @@
|
|||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build:
|
build:
|
||||||
@@ -10,7 +8,26 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
# Mount source code for hot-reloading during development
|
# Mount source code for hot-reloading during development
|
||||||
- ./src:/app/src:ro
|
- ./src:/app/src:ro
|
||||||
|
# Persist database to local directory
|
||||||
|
- ./data:/data
|
||||||
environment:
|
environment:
|
||||||
- ENVIRONMENT=development
|
- ENVIRONMENT=development
|
||||||
|
# Optional: Override admin credentials for development
|
||||||
|
# - ADMIN_USERNAME=admin
|
||||||
|
# - ADMIN_PASSWORD=devpassword
|
||||||
|
# Optional: Use Redis for token storage (uncomment redis service below)
|
||||||
|
# - REDIS_URI=redis://redis:6379/0
|
||||||
command: ["--host", "0.0.0.0", "--port", "8000", "--reload"]
|
command: ["--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# Uncomment to enable Redis token storage
|
||||||
|
# redis:
|
||||||
|
# image: redis:7-alpine
|
||||||
|
# ports:
|
||||||
|
# - "6379:6379"
|
||||||
|
# volumes:
|
||||||
|
# - redis-data:/data
|
||||||
|
# restart: unless-stopped
|
||||||
|
# Uncomment if using Redis
|
||||||
|
# volumes:
|
||||||
|
# redis-data:
|
||||||
|
|||||||
Reference in New Issue
Block a user