Skip to content

Commit acc18d0

Browse files
authored
Add Docker build and publish GitHub Worflow (#29)
* Add GitHub Actions workflow for building and pushing a Docker image. * Add path to Dockerfile in Docker build GitHub Action workflow. * Remove current branch from the Docker build GitHub Action.
1 parent c441e79 commit acc18d0

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: Build and Push Docker Image
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- '*'
10+
pull_request:
11+
branches:
12+
- main
13+
# Allow manually triggering the workflow.
14+
workflow_dispatch:
15+
16+
# Cancels all previous workflow runs for the same branch that have not yet completed.
17+
concurrency:
18+
# The concurrency group contains the workflow name and the branch name.
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build-and-push-image:
24+
permissions:
25+
contents: read
26+
packages: write
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Create docker tag (from git reference)
30+
# A tag name may only contain lower- and uppercase letters, digits, underscores, periods and dashes.
31+
run: |
32+
echo "TAG=$(echo -n "${{ github.ref_name }}" \
33+
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" \
34+
>> "${GITHUB_ENV}"
35+
- name: Checkout Repository
36+
uses: actions/checkout@v6
37+
- name: Log in to GitHub Container Registry
38+
uses: docker/login-action@v4
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Set up Docker QEMU
44+
uses: docker/setup-qemu-action@v4
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v4
47+
- name: Build and push Docker image
48+
uses: docker/build-push-action@v4
49+
with:
50+
context: .
51+
file: ./docker/solid.Dockerfile
52+
platforms: linux/amd64,linux/arm64
53+
push: true
54+
tags: "ghcr.io/${{ github.repository }}:${{ env.TAG }}"

0 commit comments

Comments
 (0)