Skip to content

Commit 4bfbe24

Browse files
committed
add copier debug container
1 parent 660f717 commit 4bfbe24

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
lines changed

.copier-answers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 4.1.0
2+
_commit: 4.2.0
33
_src_path: https://github.com/diamondlightsource/python-copier-template
44
author_email: [email protected]
55
author_name: Giles Knap
@@ -9,7 +9,7 @@ component_type: service
99
description: An example simulation IOC for testing fastCS
1010
distribution_name: fastcs-example
1111
docker: true
12-
docker_debug: false
12+
docker_debug: true
1313
docs_type: README
1414
git_platform: github.com
1515
github_org: DiamondLightSource

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua
2424

2525
This project was created using the [Diamond Light Source Copier Template](https://github.com/DiamondLightSource/python-copier-template) for Python projects.
2626

27-
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/4.1.0/how-to.html).
27+
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/4.2.0/how-to.html).

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ jobs:
4242
contents: read
4343
packages: write
4444

45+
debug_container:
46+
needs: [container, test]
47+
uses: ./.github/workflows/_debug_container.yml
48+
with:
49+
publish: ${{ needs.test.result == 'success' }}
50+
permissions:
51+
contents: read
52+
packages: write
53+
4554
dist:
4655
uses: ./.github/workflows/_dist.yml
4756

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,27 @@ WORKDIR /workspaces/fastcs-example
2020
RUN touch dev-requirements.txt && pip install -c dev-requirements.txt .[demo]
2121

2222

23+
FROM build AS debug
24+
25+
26+
# Set origin to use ssh
27+
RUN git remote set-url origin [email protected]:DiamondLightSource/fastcs-example.git
28+
29+
30+
# For this pod to understand finding user information from LDAP
31+
RUN apt update
32+
RUN DEBIAN_FRONTEND=noninteractive apt install libnss-ldapd -y
33+
RUN sed -i 's/files/ldap files/g' /etc/nsswitch.conf
34+
35+
# Make editable and debuggable
36+
RUN pip install debugpy
37+
RUN pip install -e .
38+
39+
# Alternate entrypoint to allow devcontainer to attach
40+
ENTRYPOINT [ "/bin/bash", "-c", "--" ]
41+
CMD [ "while true; do sleep 30; done;" ]
42+
43+
2344
# The runtime stage copies the built venv into a slim runtime container
2445
FROM python:${PYTHON_VERSION}-slim AS runtime
2546
# Add apt-get system dependecies for runtime here if needed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ lint.select = [
100100
"C4", # flake8-comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
101101
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
102102
"F", # pyflakes rules - https://docs.astral.sh/ruff/rules/#pyflakes-f
103+
"N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n
103104
"W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#warning-w
104105
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
105106
"UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up

0 commit comments

Comments
 (0)