|
| 1 | +name: dockerize-log-server |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + paths: |
| 9 | + - "services/log-server/**" |
| 10 | + - ".github/workflows/dockerize-log-server.yml" |
| 11 | + - "!**/*.md" |
| 12 | + - "!services/log-server/package-lock.json" |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: dockerize-log-server-${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + dockerize-log-server: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v3 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Docker meta |
| 28 | + id: meta |
| 29 | + uses: docker/metadata-action@v4 |
| 30 | + with: |
| 31 | + images: | |
| 32 | + ghcr.io/${{ github.repository_owner }}/log-server |
| 33 | + docker.io/${{ secrets.DOCKER_USERNAME }}/log-server |
| 34 | + # https://github.com/docker/metadata-action#typesemver |
| 35 | + tags: | |
| 36 | + type=raw,value=latest,enable=true |
| 37 | + type=sha,enable=true,format=short |
| 38 | +
|
| 39 | + - name: Set up QEMU |
| 40 | + uses: docker/setup-qemu-action@v2 |
| 41 | + |
| 42 | + - name: Set up Docker Buildx |
| 43 | + uses: docker/setup-buildx-action@v2 |
| 44 | + |
| 45 | + - name: Login to DockerHub |
| 46 | + uses: docker/login-action@v2 |
| 47 | + with: |
| 48 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 49 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 50 | + |
| 51 | + - name: Login to Github Container Hub |
| 52 | + uses: docker/login-action@v2 |
| 53 | + with: |
| 54 | + registry: ghcr.io |
| 55 | + username: ${{ github.repository_owner }} |
| 56 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: Build and push |
| 59 | + uses: docker/build-push-action@v3 |
| 60 | + with: |
| 61 | + context: ./services/log-server |
| 62 | + file: ./services/log-server/Dockerfile |
| 63 | + push: true |
| 64 | + tags: ${{ steps.meta.outputs.tags }} |
| 65 | + labels: ${{ steps.meta.outputs.labels }} |
| 66 | + platforms: linux/amd64, linux/arm64 |
| 67 | + |
| 68 | + trigger-workflow-build-cluster-image: |
| 69 | + needs: [dockerize-log-server] |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - name: trigger cluster image workflow |
| 73 | + uses: peter-evans/repository-dispatch@v2 |
| 74 | + with: |
| 75 | + event-type: docker_build_success |
| 76 | + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "version": "latest"}' |
0 commit comments