Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
19 changes: 19 additions & 0 deletions docs/explanations/decisions/0020-debugpy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 20. Add debugpy to service Dockerfile

Date: 2025-03-18

## Status

Accepted

## Context

Developers require a way to debug containerized services in e.g. Kubernetes.

## Decision

Add debugpy to the container image that is produced for services.

## Consequences

Debugging containerized services has a clear and documented path.
11 changes: 7 additions & 4 deletions template/Dockerfile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ FROM developer AS build
COPY . /context
WORKDIR /context
RUN touch dev-requirements.txt && pip install -c dev-requirements.txt .
RUN pip install debugpy

# The runtime stage copies the built venv into a slim runtime container
FROM python:${PYTHON_VERSION}-slim AS runtime
# Add apt-get system dependecies for runtime here if needed
# Add apt-get system dependencies for runtime here if needed
COPY --from=build /venv/ /venv/
ENV PATH=/venv/bin:$PATH

# change this entrypoint if it is not the same as the repo
ENTRYPOINT ["{{ repo_name }}"]
CMD ["--version"]{% endif %}
# change CMD if it is not the same as the repo
ENTRYPOINT ["python" "-m"]
# Allows for modifying the ENTRYPOINT for debugging, e.g.
#ENTRYPOINT ["python", "-m", "debugpy", "-m"]
CMD ["{{ repo_name }}", "--version"]{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

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

While we're at this, should we remove --version as the default use of the container is far more likely to be "run the cli", not "check the version of the cli"?

Suggested change
CMD ["{{ repo_name }}", "--version"]{% endif %}
CMD ["{{ repo_name }}"]{% endif %}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I vote to leave the Dockerfile as something that exits successfully and make it obvious how to modify it.

Loading