|
| 1 | +name: Build and Push Docker Images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - 'main' |
| 12 | + |
| 13 | +jobs: |
| 14 | + |
| 15 | + build_backend: |
| 16 | + name: Build and Push Backend |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Check out the repo |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Extract metadata (tags, labels) for Docker |
| 23 | + id: meta |
| 24 | + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
| 25 | + with: |
| 26 | + images: linea/orchestration |
| 27 | + tags: | |
| 28 | + type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},priority=100,prefix=backend_,value=latest |
| 29 | + type=semver,enable=true,priority=200,prefix=backend_v,suffix=,pattern={{version}} |
| 30 | + type=sha,enable=true,priority=300,prefix=backend_,suffix=,format=short |
| 31 | + type=raw,priority=400,prefix=backend_dev_,value=latest |
| 32 | + flavor: | |
| 33 | + latest=false |
| 34 | +
|
| 35 | + - name: Log in to Docker Hub |
| 36 | + if: github.event_name != 'pull_request' |
| 37 | + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 |
| 38 | + with: |
| 39 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 40 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 41 | + |
| 42 | + - name: Set up Docker Buildx |
| 43 | + uses: docker/setup-buildx-action@v1 |
| 44 | + |
| 45 | + - name: Build and push Docker image |
| 46 | + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc |
| 47 | + with: |
| 48 | + context: ./backend |
| 49 | + push: ${{ github.event_name != 'pull_request' }} |
| 50 | + tags: ${{ steps.meta.outputs.tags }} |
| 51 | + labels: ${{ steps.meta.outputs.labels }} |
| 52 | + # build-args: | |
| 53 | + # USERNAME=${{ secrets.PZ_USERNAME }} |
| 54 | + # USERID=${{ secrets.PZ_USERID }} |
| 55 | + # GROUPID=${{ secrets.PZ_GROUPID }} |
0 commit comments