From 16ae107e70004b3e19f6d8d486b023ab218223fd Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Tue, 10 Nov 2020 15:19:12 +0800 Subject: [PATCH] Chore: push image to github docker registry --- .github/workflows/docker.yml | 14 ++++++++++++-- Dockerfile | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6c15c03f..002a9cb3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,6 +33,13 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Login to Github Package + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: Dreamacro + password: ${{ secrets.PACKAGE_TOKEN }} - name: Build dev branch and push if: github.ref == 'refs/heads/dev' @@ -41,7 +48,7 @@ jobs: context: . platforms: linux/amd64,linux/arm/v7,linux/arm64 push: true - tags: 'dreamacro/clash:dev' + tags: 'dreamacro/clash:dev,ghcr.io/dreamacro/clash:dev' - name: Get all docker tags if: startsWith(github.ref, 'refs/tags/') @@ -49,9 +56,12 @@ jobs: id: tags with: script: | + const ref = `${context.payload.ref.replace(/\/?refs\/tags\//, '')}` const tags = [ 'dreamacro/clash:latest', - `dreamacro/clash:${context.payload.ref.replace(/\/?refs\/tags\//, '')}` + `dreamacro/clash:${ref}`, + 'ghcr.io/dreamacro/clash:latest', + `ghcr.io/dreamacro/clash:${ref}` ] return tags.join(',') result-encoding: string diff --git a/Dockerfile b/Dockerfile index e94a0d08..653d08fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ RUN go mod download && \ mv ./bin/clash-docker /clash FROM alpine:latest +LABEL org.opencontainers.image.source https://github.com/Dreamacro/clash RUN apk add --no-cache ca-certificates COPY --from=builder /Country.mmdb /root/.config/clash/