Skip to content

Commit a163c16

Browse files
author
Stefan Kuethe
committed
Push image to gh
1 parent 1fe2fed commit a163c16

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

.github/workflows/docker-image-shinylive-nginx.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,33 @@ name: Docker Image CI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ["main"]
88

99
env:
10-
IMAGE_NAME: vancouver-blocks
10+
IMAGE_NAME: shinylive-nginx
1111
VERSION: latest
1212
CONTEXT: shinylive_without_quarto
1313

1414
jobs:
15-
1615
build:
17-
1816
runs-on: ubuntu-latest
1917

2018
steps:
21-
- uses: actions/checkout@v4
22-
- name: Build the Docker image
23-
run: |
24-
cd $CONTEXT
25-
docker build . --file Dockerfile --tag $IMAGE_NAME:$(date +%s)
19+
- uses: actions/checkout@v4
20+
- name: Build the Docker image
21+
run: |
22+
cd $CONTEXT
23+
docker build . --file Dockerfile --tag $IMAGE_NAME:$VERSION
24+
25+
- name: Log in to registry
26+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u token --password-stdin
27+
28+
- name: Push image to ghcr.io
29+
run: |
30+
image_id=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
31+
# repository name must be lowercase
32+
image_id=$(echo $image_id | tr '[A-Z]' '[a-z]')
33+
docker tag $IMAGE_NAME:$VERSION $image_id:$VERSION
34+
docker push $image_id:$VERSION

0 commit comments

Comments
 (0)