Skip to content

Commit c719d76

Browse files
committed
github actions to automate building the docker image
1 parent 7166be9 commit c719d76

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Docker container
2+
3+
on:
4+
push:
5+
branches:
6+
- main # or the default branch of your repository
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v3
18+
19+
- name: Get short SHA
20+
id: short-sha
21+
run: echo "::set-output name=sha::$(echo $GITHUB_SHA | cut -c1-6)"
22+
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v2
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.repository_owner }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Build and push Docker image
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: .
34+
file: ./Dockerfile
35+
push: true
36+
tags: |
37+
ghcr.io/${{ github.repository }}/resourcespace:latest
38+
ghcr.io/${{ github.repository }}/resourcespace:${{ steps.short-sha.outputs.sha }}

0 commit comments

Comments
 (0)