-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 2.1 KB
/
main.yml
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
name: Main pipeline
on:
workflow_run:
workflows: [ "Tests" ]
branches:
types:
- completed
jobs:
# define job to build and publish docker image
build-and-push-docker-image-nightly:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
# run only when code is compiling and tests are passing
runs-on: ubuntu-22.04
env:
DOCKERHUB_TAG: ${{ github.ref_name }}
# steps to perform in job
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build image and push backend
uses: docker/build-push-action@v3
with:
# relative path to the place where source code with Dockerfile is located
file: ./Dockerfile.api
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{secrets.DOCKERHUB_USERNAME}}/api:${{ env.DOCKERHUB_TAG }}
- name: Build image and push database
uses: docker/build-push-action@v3
with:
# relative path to the place where source code with Dockerfile is located
file: ./Dockerfile.db
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{secrets.DOCKERHUB_USERNAME}}/database:${{ env.DOCKERHUB_TAG }}
- name: Build image and push httpd
uses: docker/build-push-action@v3
with:
# relative path to the place where source code with Dockerfile is located
file: ./Dockerfile.http
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{secrets.DOCKERHUB_USERNAME}}/httpd:${{ env.DOCKERHUB_TAG }}
- name: Build image and push front
uses: docker/build-push-action@v3
with:
# relative path to the place where source code with Dockerfile is located
context: ./front
file: ./front/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{secrets.DOCKERHUB_USERNAME}}/front:${{ env.DOCKERHUB_TAG }}