|
| 1 | +--- |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - '*' |
| 6 | + |
| 7 | +# This Action builds to os2display/* using ./infrastructure/os2display/* |
| 8 | +name: OS2display - Build docker image (tag) |
| 9 | + |
| 10 | +jobs: |
| 11 | + docker: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + env: |
| 14 | + COMPOSER_ALLOW_SUPERUSER: 1 |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v3 |
| 18 | + |
| 19 | + - name: Login to DockerHub |
| 20 | + uses: docker/login-action@v2 |
| 21 | + with: |
| 22 | + username: ${{ secrets.DOCKERHUB_USER }} |
| 23 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 24 | + |
| 25 | + # Build api |
| 26 | + - name: Docker meta (API) |
| 27 | + id: meta-api |
| 28 | + uses: docker/metadata-action@v4 |
| 29 | + with: |
| 30 | + images: os2display/display-api-service |
| 31 | + |
| 32 | + - name: Build and push (API) |
| 33 | + uses: docker/build-push-action@v4 |
| 34 | + with: |
| 35 | + context: ./infrastructure/os2display/display-api-service/ |
| 36 | + file: ./infrastructure/os2display/display-api-service/Dockerfile |
| 37 | + build-args: | |
| 38 | + APP_VERSION=${{ github.ref }} |
| 39 | + push: true |
| 40 | + tags: ${{ steps.meta-api.outputs.tags }} |
| 41 | + labels: ${{ steps.meta-api.outputs.labels }} |
| 42 | + |
| 43 | + # Build nginx (depends on api build) |
| 44 | + - name: Docker meta (Nginx) |
| 45 | + id: meta-nginx |
| 46 | + uses: docker/metadata-action@v4 |
| 47 | + with: |
| 48 | + images: os2display/display-api-service-nginx |
| 49 | + |
| 50 | + - name: Get the tag |
| 51 | + id: get_tag |
| 52 | + run: echo ::set-output name=git_tag::$(echo $GITHUB_REF_NAME) |
| 53 | + |
| 54 | + - name: Build and push (Nginx) |
| 55 | + uses: docker/build-push-action@v4 |
| 56 | + with: |
| 57 | + context: ./infrastructure/os2display/nginx/ |
| 58 | + file: ./infrastructure/os2display/nginx/Dockerfile |
| 59 | + build-args: | |
| 60 | + APP_VERSION=${{ steps.get_tag.outputs.git_tag }} |
| 61 | + push: true |
| 62 | + tags: ${{ steps.meta-nginx.outputs.tags }} |
| 63 | + labels: ${{ steps.meta-nginx.outputs.labels }} |
0 commit comments