Skip to content

Commit 5266f5d

Browse files
authored
Add Dockerfile and GitHub action (#211)
Builds a docker image and pushes to ghcr.io/diamondlightsource/python-zocalo
1 parent 80fbc66 commit 5266f5d

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- "dockerfile"
7+
- "main"
8+
tags:
9+
- "v*.*.*"
10+
11+
jobs:
12+
docker:
13+
if: ${{ github.repository == 'DiamondLightSource/python-zocalo' }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
-
17+
name: Checkout
18+
uses: actions/checkout@v3
19+
-
20+
name: Set up QEMU
21+
uses: docker/setup-qemu-action@v2
22+
-
23+
name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v2
25+
# -
26+
# name: Login to Docker Hub
27+
# uses: docker/login-action@v2
28+
# with:
29+
# username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
# password: ${{ secrets.DOCKERHUB_TOKEN }}
31+
-
32+
name: Login to GitHub Container Registry
33+
uses: docker/login-action@v2
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.repository_owner }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
-
39+
name: Extract metadata (tags, labels) for Docker
40+
id: meta
41+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
42+
with:
43+
images: |
44+
ghcr.io/${{ github.repository }}
45+
tags: |
46+
type=edge,branch=main
47+
type=ref,event=branch
48+
type=semver,pattern={{version}}
49+
-
50+
name: Build and push
51+
uses: docker/build-push-action@v3
52+
with:
53+
context: .
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /zocalo
4+
5+
RUN apt-get update && apt-get install -y curl
6+
RUN python -m pip install --upgrade pip
7+
8+
COPY . .
9+
10+
RUN python -m pip install --no-cache-dir .
11+
12+
CMD ["zocalo.service"]

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ History
44

55
Unreleased
66
----------
7+
* Add Dockerfile and build-and-push-docker-image GitHub workflow
78

89
0.26.0 (2022-11-04)
910
-------------------

0 commit comments

Comments
 (0)