Skip to content

Commit 1a9b772

Browse files
committed
Add container-canary.
1 parent 4b28b09 commit 1a9b772

File tree

4 files changed

+42
-17
lines changed

4 files changed

+42
-17
lines changed

.github/workflows/docker-publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ jobs:
8282
cache-from: type=gha
8383
cache-to: type=gha,mode=max
8484

85+
- name: Install Container Canary
86+
run: |
87+
curl -L https://github.com/NVIDIA/container-canary/releases/download/v0.2.1/canary_linux_amd64 > /usr/local/bin/canary
88+
chmod +x /usr/local/bin/canary
89+
90+
- name: Validate container
91+
run: canary validate --file canary-validator.yml ${{ steps.meta.outputs.tags }}
92+
8593
# Sign the resulting Docker image digest except on PRs.
8694
# This will only write to the public Rekor transparency log when the Docker
8795
# repository is public to avoid leaking data. If you would like to publish

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY requirements.txt .
66
RUN pip install --no-cache-dir --upgrade pip wheel
77
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
88

9-
COPY . .
9+
COPY . /code
1010
RUN pip install '.'
1111

1212
CMD ["uvicorn", "nsls2api.main:api", "--proxy-headers", "--host", "0.0.0.0", "--port", "8080", "--workers", "4", "--ssl-keyfile=/etc/nsls2/tls/server.key", "--ssl-certfile=/etc/nsls2/tls/server.cer"]

canary-validator.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This is used to verify that a container image has the basic expected behavior.
2+
# See https://github.com/NVIDIA/container-canary
3+
#
4+
# Run locally like:
5+
#
6+
# canary validate --file canary-validator.yml ghcr.io/bluesky/tiled:latest
7+
8+
apiVersion: container-canary.nvidia.com/v2
9+
kind: Validator
10+
name: nsls2api
11+
description: Validate that container image is operational.
12+
# env:
13+
# - name: ...
14+
# value:
15+
ports:
16+
- port: 31415
17+
protocol: TCP
18+
volumes: []
19+
checks:
20+
- name: tcp
21+
description: Is listening via TCP on port 31415
22+
probe:
23+
tcpSocket:
24+
port: 31415
25+
- name: http
26+
description: Responds HTTP GET on port 31415 at route /
27+
probe:
28+
httpGet:
29+
path: /
30+
port: 31415
31+
initialDelaySeconds: 5
32+
timeoutSeconds: 10
33+
failureThreshold: 3

src/nsls2api/_version.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)