File: docker-minimal.yml

package info (click to toggle)
weakforced 3.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,196 kB
  • sloc: cpp: 20,397; python: 2,002; sh: 700; makefile: 432
file content (80 lines) | stat: -rw-r--r-- 2,819 bytes parent folder | download | duplicates (2)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
name: 'Build minimal docker image'

on:
  push:

jobs:
  docker_test:
    name: docker_test
    runs-on: ubuntu-22.04
    env:
      # Github.refname is wrong for pull requests - have to use head ref for them
      MYREF: ${{ github.event.pull_request && github.head_ref || github.ref_name }}
      PLATFORMS: linux/arm64,linux/amd64
      DOCKERFILE: docker/wforce_image/Dockerfile.minimal
      BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
      IMAGE_NAME: wforce-minimal
      DOCKER_ORGANIZATION_NAME: ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          submodules: recursive
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3
        with:
          platforms: linux/arm64
      - name: Set up Docker Buildx for multi-platform builds
        uses: docker/setup-buildx-action@v3
        with:
          platforms: ${{ env.PLATFORMS }}
      - name: Check for release tag
        id: release_check
        run: |
          if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
            echo "release=YES" >> $GITHUB_OUTPUT
          fi
      - name: Set short git commit SHA
        id: vars
        run: |
          calculatedSha=$(git rev-parse --short ${{ github.sha }})
          echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
      - name: Login to Docker
        if: steps.release_check.outputs.release == 'YES' || env.BRANCH_NAME == 'master'
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push to docker hub for releases with tag
        id: release_build
        if: ${{ steps.release_check.outputs.release == 'YES' }}
        uses: docker/build-push-action@v5
        with:
          context: .
          file: ${{ env.DOCKERFILE }}
          platforms: ${{ env.PLATFORMS }}
          build-args: |
            license=GPLv3
            git_revision=${{ env.COMMIT_SHORT_SHA }}
            version=${{ env.MYREF }}
          push: true
          sbom: true
          tags: |
            ${{ env.DOCKER_ORGANIZATION_NAME }}/${{ env.IMAGE_NAME }}:${{ env.MYREF }}
      - name: Build and push to docker hub for master branch
        id: master_build
        if: ${{ env.BRANCH_NAME == 'master' }}
        uses: docker/build-push-action@v5
        with:
          context: .
          file: ${{ env.DOCKERFILE }}
          platforms: ${{ env.PLATFORMS }}
          build-args: |
            license=GPLv3
            git_revision=${{ env.COMMIT_SHORT_SHA }}
            version=${{ env.MYREF }}
          push: true
          sbom: true
          tags: |
            ${{ env.DOCKER_ORGANIZATION_NAME }}/${{ env.IMAGE_NAME }}:unstable