Skip to content

Commit 41c09c6

Browse files
authored
Fixes #ISSUE ### Instructions to reviewer on how to test: 1. Do thing x 2. Confirm thing y happens ### Checks for reviewer - [ ] Would the PR title make sense to a user on a set of release notes
1 parent bc68ba0 commit 41c09c6

File tree

6 files changed

+67
-23
lines changed

6 files changed

+67
-23
lines changed

.copier-answers.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 4.0.1
2+
_commit: 4.1.0
33
_src_path: https://github.com/DiamondLightSource/python-copier-template
44
author_email: [email protected]
55
author_name: Callum Forrester
@@ -10,6 +10,7 @@ description: Lightweight bluesky-as-a-service wrapper application. Also usable a
1010
a library.
1111
distribution_name: blueapi
1212
docker: true
13+
docker_debug: true
1314
docs_type: sphinx
1415
git_platform: github.com
1516
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.0.1/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.1.0/how-to.html).

.github/workflows/_container.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,6 @@ jobs:
6363
tags: |
6464
type=ref,event=tag
6565
type=raw,value=latest
66-
67-
- name: Create tags for publishing debug image
68-
id: debug-meta
69-
uses: docker/metadata-action@v5
70-
with:
71-
images: ghcr.io/${{ github.repository }}
72-
tags: |
73-
type=ref,event=tag,suffix=-debug
74-
type=raw,value=latest-debug
75-
76-
- name: Push cached image to container registry
77-
if: inputs.publish && github.ref_type == 'tag'
78-
uses: docker/build-push-action@v6
79-
env:
80-
DOCKER_BUILD_RECORD_UPLOAD: false
81-
with:
82-
context: .
83-
push: true
84-
target: debug
85-
tags: ${{ steps.debug-meta.outputs.tags }}
8666
8767
- name: Push cached image to container registry
8868
if: github.ref_type == 'tag'
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
@@ -45,6 +45,15 @@ jobs:
4545
contents: read
4646
packages: write
4747

48+
debug_container:
49+
needs: [container, test]
50+
uses: ./.github/workflows/_debug_container.yml
51+
with:
52+
publish: ${{ needs.test.result == 'success' }}
53+
permissions:
54+
contents: read
55+
packages: write
56+
4857
docs:
4958
uses: ./.github/workflows/_docs.yml
5059

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ ENV PATH=/venv/bin:$PATH
2323
# The build stage installs the context into the venv
2424
FROM developer AS build
2525
RUN mkdir -p /.cache/pip; chmod o+wrX /.cache/pip
26+
# Requires buildkit 0.17.0
2627
COPY --chmod=o+wrX . /workspaces/blueapi
2728
WORKDIR /workspaces/blueapi
2829
RUN touch dev-requirements.txt && pip install --upgrade pip && pip install -c dev-requirements.txt .
2930

31+
3032
FROM build AS debug
3133

34+
3235
# Set origin to use ssh
33-
RUN git remote set-url origin [email protected]:diamondlightsource/DiamondLightSource/blueapi.git
36+
RUN git remote set-url origin [email protected]:DiamondLightSource/blueapi.git
37+
3438

3539
# For this pod to understand finding user information from LDAP
3640
RUN apt update
@@ -45,6 +49,7 @@ RUN pip install -e .
4549
ENTRYPOINT [ "/bin/bash", "-c", "--" ]
4650
CMD [ "while true; do sleep 30; done;" ]
4751

52+
4853
# The runtime stage copies the built venv into a slim runtime container
4954
FROM python:${PYTHON_VERSION}-slim AS runtime
5055
# Add apt-get system dependecies for runtime here if needed

0 commit comments

Comments
 (0)