- Switch from Debian (python:3.11-slim) to Alpine (python:3.11-alpine) for better ARM64 support - Replace apt-get with apk package manager for lighter, faster builds - Update package dependencies for Alpine (musl-dev, postgresql-dev, linux-headers) - Change user creation from useradd to adduser (Alpine syntax) - Add .gitkeep files to preserve empty alembic directories in git - Update all quickstart scripts to always rebuild containers with --build flag - Fixes ARM64 package installation errors on Apple Silicon Macs - Fixes missing alembic directory errors on fresh clones 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
38 lines
944 B
Docker
38 lines
944 B
Docker
FROM python:3.11-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies for Alpine
|
|
# Alpine uses apk instead of apt-get and is lighter/faster
|
|
RUN apk add --no-cache \
|
|
gcc \
|
|
musl-dev \
|
|
postgresql-dev \
|
|
postgresql-client \
|
|
linux-headers
|
|
|
|
# Copy requirements and install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY app/ ./app/
|
|
COPY utils/ ./utils/
|
|
COPY alembic/ ./alembic/
|
|
COPY alembic.ini .
|
|
COPY static/ ./static/
|
|
|
|
# Create non-root user (Alpine uses adduser instead of useradd)
|
|
RUN adduser -D -u 1000 appuser && chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import requests; requests.get('http://localhost:8000/health')"
|
|
|
|
# Run the application
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|