|
1 | | -name: Build and Push Docker Image |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: |
6 | | - - master |
7 | | - paths-ignore: |
8 | | - - 'readme.md' |
9 | | - - 'dist/index.js' |
10 | | - workflow_dispatch: |
11 | | - |
12 | | -env: |
13 | | - GHCR_REPO: ghcr.io/leafmoes/ddg-chat |
14 | | - DOCKER_HUB_REPO: leafmoes/ddg-chat |
15 | | - |
16 | | -jobs: |
17 | | - docker: |
18 | | - runs-on: ubuntu-latest |
19 | | - steps: |
20 | | - - name: Checkout |
21 | | - uses: actions/checkout@v2 |
22 | | - |
23 | | - - name: Set up QEMU |
24 | | - uses: docker/setup-qemu-action@v3 |
25 | | - |
26 | | - - name: Set up Docker Buildx |
27 | | - uses: docker/setup-buildx-action@v3 |
28 | | - |
29 | | - - name: Login to GitHub Container Registry |
30 | | - uses: docker/login-action@v1 |
31 | | - with: |
32 | | - registry: ghcr.io |
33 | | - username: ${{ github.repository_owner }} |
34 | | - password: ${{ secrets.GHCR_PAT }} |
35 | | - |
36 | | - - name: Login to Docker Hub |
37 | | - uses: docker/login-action@v2 |
38 | | - with: |
39 | | - username: ${{ secrets.DOCKERHUB_USERNAME }} |
40 | | - password: ${{ secrets.DOCKERHUB_PASSWORD }} |
41 | | - |
42 | | - - name: Get short SHA |
43 | | - id: slug |
44 | | - run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" |
45 | | - |
46 | | - - name: Build and push to GitHub Container Registry |
47 | | - uses: docker/build-push-action@v6 |
48 | | - with: |
49 | | - context: . |
50 | | - platforms: linux/amd64,linux/arm64 |
51 | | - file: Dockerfile |
52 | | - push: true |
53 | | - tags: | |
54 | | - ${{ env.GHCR_REPO }}:latest |
55 | | - ${{ env.GHCR_REPO }}:${{ steps.slug.outputs.sha7 }} |
56 | | - cache-from: type=gha |
57 | | - cache-to: type=gha,mode=max |
58 | | - |
59 | | - - name: Build and push to Docker Hub |
60 | | - uses: docker/build-push-action@v6 |
61 | | - with: |
62 | | - context: . |
63 | | - platforms: linux/amd64,linux/arm64 |
64 | | - file: Dockerfile |
65 | | - push: true |
66 | | - tags: | |
67 | | - ${{ env.DOCKER_HUB_REPO }}:latest |
68 | | - ${{ env.DOCKER_HUB_REPO }}:${{ steps.slug.outputs.sha7 }} |
69 | | - cache-from: type=gha |
70 | | - cache-to: type=gha,mode=max |
| 1 | +name: Build and Push Docker Image |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths-ignore: |
| 8 | + - 'readme.md' |
| 9 | + - 'dist/index.js' |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +env: |
| 13 | + GHCR_REPO: ghcr.io/leafmoes/ddg-chat |
| 14 | + DOCKER_HUB_REPO: leafmoes/ddg-chat |
| 15 | + |
| 16 | +jobs: |
| 17 | + docker: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: Set up QEMU |
| 24 | + uses: docker/setup-qemu-action@v3 |
| 25 | + |
| 26 | + - name: Set up Docker Buildx |
| 27 | + uses: docker/setup-buildx-action@v3 |
| 28 | + |
| 29 | + - name: Login to GitHub Container Registry |
| 30 | + uses: docker/login-action@v1 |
| 31 | + with: |
| 32 | + registry: ghcr.io |
| 33 | + username: ${{ github.repository_owner }} |
| 34 | + password: ${{ secrets.GHCR_PAT }} |
| 35 | + |
| 36 | + - name: Login to Docker Hub |
| 37 | + uses: docker/login-action@v2 |
| 38 | + with: |
| 39 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 40 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 41 | + |
| 42 | + - name: Get short SHA |
| 43 | + id: slug |
| 44 | + run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" |
| 45 | + |
| 46 | + - name: Build and push to GitHub Container Registry |
| 47 | + uses: docker/build-push-action@v6 |
| 48 | + with: |
| 49 | + context: . |
| 50 | + platforms: linux/amd64,linux/arm64 |
| 51 | + file: Dockerfile |
| 52 | + push: true |
| 53 | + tags: | |
| 54 | + ${{ env.GHCR_REPO }}:latest |
| 55 | + ${{ env.GHCR_REPO }}:${{ steps.slug.outputs.sha7 }} |
| 56 | + cache-from: type=gha |
| 57 | + cache-to: type=gha,mode=max |
| 58 | + |
| 59 | + - name: Build and push to Docker Hub |
| 60 | + uses: docker/build-push-action@v6 |
| 61 | + with: |
| 62 | + context: . |
| 63 | + platforms: linux/amd64,linux/arm64 |
| 64 | + file: Dockerfile |
| 65 | + push: true |
| 66 | + tags: | |
| 67 | + ${{ env.DOCKER_HUB_REPO }}:latest |
| 68 | + ${{ env.DOCKER_HUB_REPO }}:${{ steps.slug.outputs.sha7 }} |
| 69 | + cache-from: type=gha |
| 70 | + cache-to: type=gha,mode=max |
0 commit comments