-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (61 loc) · 2.24 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
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Publish Docker image to DockerHub
on:
push:
branches:
- main
jobs:
perform_pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
coverage run -m pytest ./tests/api_test/ -v -s
push_app_to_registry:
name: Push APP Docker image to Docker Hub
needs: perform_pytest
runs-on: ubuntu-latest
steps:
- name: 1 Copy repository
uses: actions/checkout@v2
- name: 2 Docker login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: 3 Build APP IMAGE
run: docker build -t app -f ./src/app/backend/dockerfile_api .
- name: 4 Tag
run: |
docker tag app ${{ secrets.DOCKER_USER }}/app:${{ github.sha }}
docker tag app ${{ secrets.DOCKER_USER }}/app:latest
- name: 5 SPush
run: |
docker push ${{ secrets.DOCKER_USER }}/app:${{ github.sha }}
docker push ${{ secrets.DOCKER_USER }}/app:latest
push_web_to_registry:
name: Push WEB Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: 1 Copy repository
uses: actions/checkout@v2
- name: 2 Docker login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: 3 Build APP IMAGE
run: docker build -t web -f ./src/app/frontend/dockerfile_web .
- name: 4 Tag
run: |
docker tag web ${{ secrets.DOCKER_USER }}/web:${{ github.sha }}
docker tag web ${{ secrets.DOCKER_USER }}/web:latest
- name: 5 SPush
run: |
docker push ${{ secrets.DOCKER_USER }}/web:${{ github.sha }}
docker push ${{ secrets.DOCKER_USER }}/web:latest