Chore: push image to github docker registry

This commit is contained in:
Dreamacro 2020-11-10 15:19:12 +08:00
parent 83efe2ae57
commit 16ae107e70
2 changed files with 13 additions and 2 deletions

View File

@ -34,6 +34,13 @@ jobs:
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'
uses: docker/build-push-action@v2
@ -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

View File

@ -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/