Skip to content

Commit c5cac12

Browse files
committed
workflow: push docker image to ghcr.io
1 parent b1eaaee commit c5cac12

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/docker.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-22.04
11+
permissions:
12+
packages: write
13+
contents: read
1114
steps:
1215
- uses: actions/checkout@v4
1316
- name: Install packages
@@ -28,6 +31,11 @@ jobs:
2831
with:
2932
username: ${{ secrets.DOCKER_HUB_USER }}
3033
password: ${{ secrets.DOCKER_HUB_TOKEN }}
34+
- uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
3139
- name: Determine docker tags
3240
id: docker_tag
3341
run: |
@@ -42,18 +50,22 @@ jobs:
4250
echo "ALPINE_TAG=tsl0922/ttyd:alpine" >> $GITHUB_ENV
4351
esac
4452
- name: build/push docker image
45-
uses: docker/build-push-action@v5
53+
uses: docker/build-push-action@v6
4654
with:
4755
context: .
4856
file: ./Dockerfile
4957
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/s390x
5058
push: true
51-
tags: ${{ env.DOCKER_TAG }}
59+
tags: |
60+
${{ env.DOCKER_TAG }}
61+
ghcr.io/${{ env.ALPINE_TAG }}
5262
- name: build/push docker image (alpine)
53-
uses: docker/build-push-action@v5
63+
uses: docker/build-push-action@v6
5464
with:
5565
context: .
5666
file: ./Dockerfile.alpine
5767
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/s390x
5868
push: true
59-
tags: ${{ env.ALPINE_TAG }}
69+
tags: |
70+
${{ env.ALPINE_TAG }}
71+
ghcr.io/${{ env.ALPINE_TAG }}

0 commit comments

Comments
 (0)