49 lines
1.2 KiB
Docker
49 lines
1.2 KiB
Docker
# Multi-stage Docker build for DosVault
|
|
FROM python:3.11-slim as base
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
gcc \
|
|
g++ \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy Python dependencies
|
|
COPY requirements.txt* pyproject.toml* ./
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt || \
|
|
pip install --no-cache-dir fastapi uvicorn sqlalchemy alembic \
|
|
aiohttp bcrypt python-jose python-multipart jinja2
|
|
|
|
# Copy application code
|
|
COPY src/ ./src/
|
|
COPY templates/ ./templates/
|
|
COPY migrations/ ./migrations/
|
|
COPY alembic.ini ./
|
|
COPY CLAUDE.md README.md ./
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /app/data/logs /app/data/images /app/data/roms /app/data/metadata
|
|
|
|
# Set environment variables
|
|
ENV PYTHONPATH=/app
|
|
ENV DOSFRONTEND_CONFIG_DIR=/app/data
|
|
|
|
# Expose ports
|
|
EXPOSE 8080 8081
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 dosvault && \
|
|
chown -R dosvault:dosvault /app
|
|
USER dosvault
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8080/health || exit 1
|
|
|
|
# Default command
|
|
CMD ["python", "-m", "uvicorn", "src.webapp:app", "--host", "0.0.0.0", "--port", "8080"] |