11# syntax=docker/dockerfile:1
22
3- # Comments are provided throughout this file to help you get started.
4- # If you need more help, visit the Dockerfile reference guide at
5- # https://docs.docker.com/go/dockerfile-reference/
6-
7- # Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
8-
93ARG PYTHON_VERSION=3.13.11
104FROM python:${PYTHON_VERSION}-slim as base
115
12- # Prevents Python from writing pyc files.
136ENV PYTHONDONTWRITEBYTECODE=1
14-
15- # Keeps Python from buffering stdout and stderr to avoid situations where
16- # the application crashes without emitting any logs due to buffering.
177ENV PYTHONUNBUFFERED=1
188
199WORKDIR /app
2010
21- # Create a non-privileged user that the app will run under.
22- # See https://docs.docker.com/go/dockerfile-user-best-practices/
2311ARG UID=10001
2412RUN adduser \
2513 --disabled-password \
@@ -30,22 +18,18 @@ RUN adduser \
3018 --uid "${UID}" \
3119 appuser
3220
33- # Download dependencies as a separate step to take advantage of Docker's caching.
34- # Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
35- # Leverage a bind mount to requirements.txt to avoid having to copy them into
36- # into this layer.
3721RUN --mount=type=cache,target=/root/.cache/pip \
3822 --mount=type=bind,source=requirements.txt,target=requirements.txt \
3923 python -m pip install -r requirements.txt
4024
41- # Switch to the non-privileged user to run the application.
4225USER appuser
4326
44- # Copy the source code into the container.
4527COPY . .
4628
47- # Expose the port that the application listens on.
29+ # Copy and load environment variables
30+ COPY example.env .
31+ RUN export $(cat .env | xargs)
32+
4833EXPOSE 8000
4934
50- # Run the application.
5135CMD gunicorn wsgi:app --bind=0.0.0.0:8000
0 commit comments