Skip to content

[DGUK-484] Bring prod/dev dockerfiles together#43

Open
currycoder wants to merge 6 commits intomainfrom
DGUK-484-bring-dockerfiles-together
Open

[DGUK-484] Bring prod/dev dockerfiles together#43
currycoder wants to merge 6 commits intomainfrom
DGUK-484-bring-dockerfiles-together

Conversation

@currycoder
Copy link
Copy Markdown
Collaborator

This change makes use of docker multi stage builds to ensure that we have a single Dockerfile for local development AND production.

The build stage for production is python-run-production, for dev is python-run-dev. Common steps are run in python-build-stage

Comment thread docker/Dockerfile
&& chmod 0440 /etc/sudoers.d/dev-user

COPY --from=python-build-stage ${APP_HOME}/.venv ${VIRTUAL_ENV}
# Requirements are installed here to ensure they will be cached.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great :) i like the multi stage build for dev and production.

I thought the binds had repitition --mount=type=bind,source=pyproject.toml and --mount=type=bind,source=uv.lock

so thought maybe copying over those files would mean it's less duplicated and more readable.

What do you think?

COPY pyproject.toml uv.lock ./

RUN --mount=type=cache,target=/root/.cache/uv \
    uv sync --no-install-project

RUN --mount=type=cache,target=/root/.cache/uv \
    uv sync

RUN --mount=type=cache,target=/root/.cache/uv \
    uv run playwright install --with-deps chromium

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call - I've done that 👍

Copy link
Copy Markdown
Contributor

@Obsiye Obsiye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants