# Stage 1: Build stage FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder # Install system dependencies and libraries required for building RUN apk add --no-cache \ build-base \ gcc \ musl-dev \ libffi-dev \ openssl-dev \ curl WORKDIR /app # Copy and install Python dependencies COPY requirements.txt /app RUN pip3 install --no-cache-dir -r requirements.txt # Copy application code COPY . /app # Stage 2: Final image FROM python:3.10-alpine WORKDIR /app # Copy the installed dependencies and the app from the builder stage COPY --from=builder /app /app # Expose the application port EXPOSE 8000 # Copy entrypoint script and set permissions COPY github-action/scripts/entrypoint_python.sh /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh # Set the entrypoint ENTRYPOINT ["/docker-entrypoint.sh"] # Run the application using Gunicorn CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers=3"]