aligned docker files
This commit is contained in:
+13
-5
@@ -7,7 +7,8 @@ ENV PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
UV_PROJECT_ENVIRONMENT=/app/.venv \
|
||||
ENVIRONMENT=production
|
||||
ENVIRONMENT=production \
|
||||
DATA_DIR=/data
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
@@ -18,14 +19,18 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
||||
# Copy dependency files
|
||||
COPY pyproject.toml README.md ./
|
||||
|
||||
# Install Python dependencies
|
||||
RUN uv sync --no-dev
|
||||
# Copy application code
|
||||
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
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
# Copy application code
|
||||
COPY src/ ./src/
|
||||
# Create data directory for SQLite database
|
||||
RUN mkdir -p /data && chmod 777 /data
|
||||
|
||||
# Add healthcheck
|
||||
HEALTHCHECK \
|
||||
@@ -39,6 +44,9 @@ HEALTHCHECK \
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
# Declare volume for persistent data
|
||||
VOLUME /data
|
||||
|
||||
# Set entrypoint to restrict usage to uvicorn with this specific app
|
||||
ENTRYPOINT ["uvicorn", "src.baby_monitor.main:app"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user