Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# ignore everything beginning with dot by default
.*
!.env.docker

ansible*

Expand Down
22 changes: 14 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11 as production
FROM python:3.11 AS production

# Update the package listing, so we know what packages exist
RUN apt-get update
Expand Down Expand Up @@ -40,19 +40,25 @@ USER deploy
RUN python -m venv $VIRTUAL_ENV

# Add our python libraries for managing dependencies
uv 0.1.43 is triggering bad certificate errors, so we pin to 0.1.39
RUN python -m pip install uv==0.1.39 wheel --upgrade
RUN python -m pip install uv wheel --upgrade

# Copy just the pyproject.toml for uv sync.
# That way, the next step can be cached until pyproject.toml changes.
COPY --chown=deploy ./pyproject.toml ./pyproject.toml

# Install dependencies via uv
RUN uv sync

# Copy application code, with dockerignore filtering out the stuff we don't want
# from our final build artefact
COPY --chown=deploy . .

# Install dependencies via uv
RUN uv pip install -r requirements/requirements.linux.generated.txt
# Copy envfile to the correct location.
COPY --chown=deploy .env.docker .env

# Set up front end pipeline
RUN python ./manage.py tailwind install
RUN python ./manage.py tailwind build
RUN dotenv run -- python ./manage.py tailwind install
RUN dotenv run -- python ./manage.py tailwind build

# Install the other node dependencies
# TODO: we might not need node in production *at all* if we can generate
Expand All @@ -63,7 +69,7 @@ RUN cd ./apps/theme/static_src/ && \
npx rollup --config

# Collect static files
RUN python ./manage.py collectstatic --noinput --clear
RUN dotenv run -- python ./manage.py collectstatic --noinput --clear

# Use the shell form of CMD, so we have access to our environment variables
# $GUNICORN_CMD_ARGS allows us to add additional arguments to the gunicorn command
Expand Down
Loading