]> Repositorios git - scryer-prolog.git/commitdiff
push Docker image on new release
authorNiklas Gruhn <[email protected]>
Thu, 14 Apr 2022 14:33:57 +0000 (16:33 +0200)
committerNiklas Gruhn <[email protected]>
Thu, 14 Apr 2022 19:42:28 +0000 (21:42 +0200)
Setup GitHub action which automatically builds and pushes Docker
images, when new release tags are created.

.github/workflows/docker-publish.yml [new file with mode: 0644]
Dockerfile

diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
new file mode 100644 (file)
index 0000000..b31829e
--- /dev/null
@@ -0,0 +1,52 @@
+name: Docker Publish
+
+on:
+  push:
+    tags: [ 'v*.*.*' ]
+
+env:
+  IMAGE_NAME: mjt128/scryer-prolog
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      # Workaround: https://github.com/docker/build-push-action/issues/461
+      - name: Setup Docker buildx
+        uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
+
+      # Login against Docker registry
+      # https://github.com/docker/login-action
+      - name: Log into registry
+        uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+      # Extract Docker image tag from git tag. E.g. if git tag is "v0.19.1" then use 
+      # Docker image tag "0.19.1". Tag "latest" is automatically synced with newest
+      # version.
+      # https://github.com/docker/metadata-action
+      - name: Extract Docker metadata
+        id: meta
+        uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
+        with:
+          images: docker.io/${{ env.IMAGE_NAME }}
+          tags: |
+            type=semver,pattern={{version}}
+
+      # Build and push Docker image with Buildx
+      # https://github.com/docker/build-push-action
+      - name: Build and push Docker image
+        id: build-and-push
+        uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+        with:
+          context: .
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
index 12f49bca372b13b978e05955cbb16cb6c147ffc7..501a2dce6cef95c27ea14e51e3fff8d087415082 100755 (executable)
@@ -1,5 +1,5 @@
 # See https://github.com/LukeMathWalker/cargo-chef
-ARG RUST_VERSION=1.52.1-buster
+ARG RUST_VERSION=1.60-buster
 FROM rust:${RUST_VERSION} as planner
 WORKDIR /scryer-prolog
 RUN cargo install cargo-chef