Skip to content

Commit b05fa18

Browse files
committed
refactor: Remove unnecessary comments and improve Dockerfile clarity
1 parent 28a57a8 commit b05fa18

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

Dockerfile

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
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-
93
ARG PYTHON_VERSION=3.13.11
104
FROM python:${PYTHON_VERSION}-slim as base
115

12-
# Prevents Python from writing pyc files.
136
ENV 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.
177
ENV PYTHONUNBUFFERED=1
188

199
WORKDIR /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/
2311
ARG UID=10001
2412
RUN 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.
3721
RUN --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.
4225
USER appuser
4326

44-
# Copy the source code into the container.
4527
COPY . .
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+
4833
EXPOSE 8000
4934

50-
# Run the application.
5135
CMD gunicorn wsgi:app --bind=0.0.0.0:8000

0 commit comments

Comments
 (0)