-
Notifications
You must be signed in to change notification settings - Fork 45
68 lines (57 loc) · 2.44 KB
/
docker.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
name: Publish Docker image
# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
workflow_dispatch:
push:
branches: ["feature"]
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ${{ secrets.BUILD_ACR_URL }}
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check disk space
run: df . -h
- name: Extract version
run: |
pip install poetry
VERSION_TAG=$(poetry version --short)
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Login to ACR Hangzhou region
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.ACR_USER }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build and push base image
env:
IMAGE_TAG: ${{env.VERSION_TAG}}
run: |
docker build -t ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG .
docker push ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG
- name: Build and push UI image
env:
IMAGE_TAG: ${{env.VERSION_TAG}}-ui
run: |
docker build -t ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG -f Dockerfile_ui .
docker push ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG
- name: Build and push nginx image
env:
IMAGE_TAG: ${{env.VERSION_TAG}}-nginx
run: |
docker build -t ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG -f Dockerfile_nginx .
docker push ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG
- name: Build and push GPU image
env:
IMAGE_TAG: ${{env.VERSION_TAG}}-gpu
run: |
docker build -t ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG -f Dockerfile_gpu .
docker push ${{ env.REGISTRY }}/mybigpai/pairag:$IMAGE_TAG
- name: Free disk space
run: |
docker system prune -a -f