-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (58 loc) · 2.11 KB
/
dockers.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Build Docker Image
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
env:
APP_NAME: caddy
jobs:
Dockerhub:
name: Build Docker Image and Push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ACR
uses: docker/login-action@v3
with:
registry: registry.cn-shanghai.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate app version
run: echo "APP_VERSION=$(date +'%y%m%d')" >> $GITHUB_ENV
- name: Set GHCR username
run: |
echo "GITHUB_USER=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
ACR_NAMESPACE: ${{ secrets.ACR_NAMESPACE }}
with:
push: true
context: .
platforms: |
linux/amd64
linux/arm64/v8
tags: |
${{ env.DOCKERHUB_USER }}/${{ env.APP_NAME }}:latest
${{ env.DOCKERHUB_USER }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}
ghcr.io/${{ env.GITHUB_USER }}/${{ env.APP_NAME }}:latest
ghcr.io/${{ env.GITHUB_USER }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}
registry.cn-shanghai.aliyuncs.com/${{ env.ACR_NAMESPACE }}/${{ env.APP_NAME }}:latest
registry.cn-shanghai.aliyuncs.com/${{ env.ACR_NAMESPACE }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}