Skip to content

Commit ae11978

Browse files
committed
update to debugging branch of copier-template
1 parent b4e1b7b commit ae11978

File tree

6 files changed

+88
-3
lines changed

6 files changed

+88
-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-1-g1797f00
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).
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
publish:
5+
type: boolean
6+
description: If true, pushes image to container registry
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
# Need this to get version number from last tag
17+
fetch-depth: 0
18+
19+
- name: Set up Docker Buildx
20+
id: buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to GitHub Docker Registry
24+
if: github.event_name != 'pull_request'
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Create tags for publishing debug image
32+
id: debug-meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ghcr.io/${{ github.repository }}
36+
tags: |
37+
type=ref,event=tag,suffix=-debug
38+
type=raw,value=latest-debug
39+
40+
- name: Build and publish debug image to container registry
41+
if: github.ref_type == 'tag'
42+
uses: docker/build-push-action@v6
43+
env:
44+
DOCKER_BUILD_RECORD_UPLOAD: false
45+
with:
46+
context: .
47+
push: true
48+
target: debug
49+
tags: ${{ steps.debug-meta.outputs.tags }}

.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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,32 @@ WORKDIR /workspaces/fastcs-example
2626
RUN touch dev-requirements.txt && pip install -c dev-requirements.txt .[demo]
2727

2828

29+
FROM build AS debug
30+
31+
32+
# Set origin to use ssh
33+
RUN git remote set-url origin [email protected]:DiamondLightSource/fastcs-example.git
34+
35+
36+
# Make editable and debuggable
37+
RUN pip install debugpy
38+
RUN pip install -e '.[dev]'
39+
RUN chmod o+wrX /venv
40+
41+
RUN apt-get update && \
42+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
43+
busybox \
44+
libnss-ldapd \
45+
&& rm -rf /var/lib/apt/lists/* \
46+
&& busybox --install -s
47+
# For this pod to understand finding user information from LDAP
48+
RUN sed -i 's/files/ldap files/g' /etc/nsswitch.conf
49+
50+
# Alternate entrypoint to allow devcontainer to attach
51+
ENTRYPOINT [ "/bin/bash", "-c", "--" ]
52+
CMD [ "while true; do sleep 30; done;" ]
53+
54+
2955
# The runtime stage copies the built venv into a slim runtime container
3056
FROM python:${PYTHON_VERSION}-slim AS runtime
3157

pyproject.toml

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

0 commit comments

Comments
 (0)