-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (81 loc) · 2.47 KB
/
build.yaml
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
75
76
77
78
79
80
81
82
83
name: ci
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Print current branch
run: echo "${BRANCH_NAME}"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Api
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
uses: docker/build-push-action@v6
with:
build-args: |
ADMIN_PASSWORD=admin
API_PORT=5000
context: .
file: Dockerfile-api
push: false
tags: basil-api_${{ env.BRANCH_NAME }}
outputs: type=docker,dest=/tmp/basil-api.tar
- name: Build App
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
uses: docker/build-push-action@v6
with:
build-args: |
API_ENDPOINT=http://localhost:5000
context: .
file: Dockerfile-app
push: false
tags: basil-app_${{ env.BRANCH_NAME }}
outputs: type=docker,dest=/tmp/basil-app.tar
- name: Upload basil-api artifact
uses: actions/upload-artifact@v4
with:
name: basil-api
path: /tmp/basil-api.tar
- name: Upload basil-app artifact
uses: actions/upload-artifact@v4
with:
name: basil-app
path: /tmp/basil-app.tar
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download basil-api artifacts
uses: actions/download-artifact@v4
with:
name: basil-api
path: /tmp
- name: Download basil-app artifacts
uses: actions/download-artifact@v4
with:
name: basil-app
path: /tmp
- name: Load images
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
docker load --input /tmp/basil-api.tar
docker load --input /tmp/basil-app.tar
docker image ls -a
docker run -d --privileged --network=host basil-api_${{ env.BRANCH_NAME }}
docker run -d --network=host basil-app_${{ env.BRANCH_NAME }}
sleep 60
docker ps
echo "Test Api is running"
curl -vf http://localhost:5000/version
echo "Test App is running"
curl -vf http://localhost:9000