diff --git a/Dockerfile b/Dockerfile index 89aba64..66de827 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,15 @@ -FROM python:3.11-slim +FROM python:3.11-alpine WORKDIR /app -# Install system dependencies -# Use --no-install-recommends and handle both amd64 and arm64 architectures -RUN apt-get update && apt-get install -y --no-install-recommends \ +# 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 \ - libpq-dev \ - && rm -rf /var/lib/apt/lists/* + linux-headers # Copy requirements and install Python dependencies COPY requirements.txt . @@ -21,8 +22,8 @@ COPY alembic/ ./alembic/ COPY alembic.ini . COPY static/ ./static/ -# Create non-root user -RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app +# 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