Skip to content

Commit

Permalink
Add Dockerfile and GitHub action (#211)
Browse files Browse the repository at this point in the history
Builds a docker image and pushes to ghcr.io/diamondlightsource/python-zocalo
  • Loading branch information
rjgildea authored Dec 5, 2022
1 parent 80fbc66 commit 5266f5d
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build-and-push-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: ci

on:
push:
branches:
- "dockerfile"
- "main"
tags:
- "v*.*.*"

jobs:
docker:
if: ${{ github.repository == 'DiamondLightSource/python-zocalo' }}
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# -
# name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=edge,branch=main
type=ref,event=branch
type=semver,pattern={{version}}
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.11-slim

WORKDIR /zocalo

RUN apt-get update && apt-get install -y curl
RUN python -m pip install --upgrade pip

COPY . .

RUN python -m pip install --no-cache-dir .

CMD ["zocalo.service"]
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ History

Unreleased
----------
* Add Dockerfile and build-and-push-docker-image GitHub workflow

0.26.0 (2022-11-04)
-------------------
Expand Down

0 comments on commit 5266f5d

Please sign in to comment.