|
1 |
| -name: Docker Image |
| 1 | +name: Docker image v2 |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - release: |
6 |
| - types: |
7 |
| - - created |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "**" |
| 7 | + tags: |
| 8 | + - "v*.*.*" |
| 9 | + pull_request: |
8 | 10 |
|
9 | 11 | jobs:
|
10 |
| - create-docker-image: |
11 |
| - runs-on: ubuntu-latest |
12 |
| - steps: |
13 |
| - - uses: actions/checkout@v2 |
14 |
| - |
15 |
| - - name: Setup go |
16 |
| - uses: actions/setup-go@v2 |
17 |
| - with: |
18 |
| - go-version: 1.15 |
19 |
| - |
20 |
| - - name: Build |
21 |
| - run: CGO_ENABLED=0 go build |
22 |
| - |
23 |
| - - name: Publish to Registry |
24 |
| - uses: elgohr/Publish-Docker-Github-Action@master |
25 |
| - with: |
26 |
| - name: ftpserver/ftpserver |
27 |
| - username: ftpserver |
28 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
29 |
| - tag_semver: true |
| 12 | + multi-registries: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v2 |
| 17 | + - name: Docker meta |
| 18 | + id: docker_meta |
| 19 | + uses: crazy-max/ghaction-docker-meta@v1 |
| 20 | + with: |
| 21 | + images: fclairamb/ftpserver |
| 22 | + - name: Set up QEMU |
| 23 | + uses: docker/setup-qemu-action@v1 |
| 24 | + - name: Set up Docker Buildx |
| 25 | + uses: docker/setup-buildx-action@v1 |
| 26 | + - name: Cache Docker layers |
| 27 | + uses: actions/cache@v2 |
| 28 | + with: |
| 29 | + path: /tmp/.buildx-cache |
| 30 | + key: ${{ runner.os }}-buildx-${{ github.sha }} |
| 31 | + restore-keys: | |
| 32 | + ${{ runner.os }}-buildx- |
| 33 | + - name: Login to DockerHub |
| 34 | + uses: docker/login-action@v1 |
| 35 | + with: |
| 36 | + username: ${{ github.repository_owner }} |
| 37 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 38 | + - name: Login to GitHub Container Registry |
| 39 | + uses: docker/login-action@v1 |
| 40 | + with: |
| 41 | + registry: ghcr.io |
| 42 | + username: ${{ github.repository_owner }} |
| 43 | + password: ${{ secrets.CR_PAT }} |
| 44 | + - name: Build and push |
| 45 | + uses: docker/build-push-action@v2 |
| 46 | + with: |
| 47 | + context: . |
| 48 | + file: ./Dockerfile |
| 49 | + platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64 |
| 50 | + push: true |
| 51 | + tags: ${{ steps.docker_meta.outputs.tags }} |
| 52 | + labels: ${{ steps.docker_meta.outputs.labels }} |
| 53 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 54 | + cache-to: type=local,dest=/tmp/.buildx-cache |
0 commit comments