build #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
workflow_run: | |
workflows: | |
- test | |
types: | |
- completed | |
branches: | |
- main | |
jobs: | |
build-and-push-docker-image: | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Login to DockerHub | |
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build image and push backend | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
tags: ${{secrets.DOCKERHUB_USERNAME}}/tp-devops-simple-api:latest | |
push: ${{ github.ref == 'refs/heads/main' }} | |
- name: Build image and push database | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./deployment/database | |
tags: ${{secrets.DOCKERHUB_USERNAME}}/tp-devops-database:latest | |
push: ${{ github.ref == 'refs/heads/main' }} | |
- name: Build image and push httpd | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./deployment/router | |
tags: ${{secrets.DOCKERHUB_USERNAME}}/tp-devops-httpd:latest | |
push: ${{ github.ref == 'refs/heads/main' }} | |
- name: Build image and push front | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./front | |
tags: ${{secrets.DOCKERHUB_USERNAME}}/tp-devops-front:latest | |
push: ${{ github.ref == 'refs/heads/main' }} |