-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (68 loc) · 2.65 KB
/
publish-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
69
70
71
72
73
74
75
name: Publish Docker Images
on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Determine Version and Build Number
id: version
run: |
echo "BUILD_NUM=${{ github.run_number }}" >> $GITHUB_ENV
if [ "${{ github.ref_type }}" == "tag" ]; then
echo "VERSION=${{ github.ref_name }}.${{ github.run_number }}" >> $GITHUB_ENV
else
echo "VERSION=latest" >> $GITHUB_ENV
fi
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_API_KEY }}
- name: Build and Push API Image
run: |
docker build \
--build-arg VERSION=${{ env.VERSION }} \
--build-arg BUILD_NUM=${{ env.BUILD_NUM }} \
-t ${{ secrets.DOCKER_USERNAME }}/chipper:api-${{ env.VERSION }} \
services/api
docker push ${{ secrets.DOCKER_USERNAME }}/chipper:api-${{ env.VERSION }}
- name: Build and Push Web Image
run: |
docker build \
--build-arg VERSION=${{ env.VERSION }} \
--build-arg BUILD_NUM=${{ env.BUILD_NUM }} \
-t ${{ secrets.DOCKER_USERNAME }}/chipper:web-${{ env.VERSION }} \
services/web
docker push ${{ secrets.DOCKER_USERNAME }}/chipper:web-${{ env.VERSION }}
- name: Build and Push CLI Tool Image
run: |
docker build \
--build-arg VERSION=${{ env.VERSION }} \
--build-arg BUILD_NUM=${{ env.BUILD_NUM }} \
-t ${{ secrets.DOCKER_USERNAME }}/chipper:cli-${{ env.VERSION }} \
tools/cli
docker push ${{ secrets.DOCKER_USERNAME }}/chipper:cli-${{ env.VERSION }}
- name: Build and Push Embed Tool Image
run: |
docker build \
--build-arg VERSION=${{ env.VERSION }} \
--build-arg BUILD_NUM=${{ env.BUILD_NUM }} \
-t ${{ secrets.DOCKER_USERNAME }}/chipper:embed-${{ env.VERSION }} \
tools/embed
docker push ${{ secrets.DOCKER_USERNAME }}/chipper:embed-${{ env.VERSION }}
- name: Build and Push Scrape Tool Image
run: |
docker build \
--build-arg VERSION=${{ env.VERSION }} \
--build-arg BUILD_NUM=${{ env.BUILD_NUM }} \
-t ${{ secrets.DOCKER_USERNAME }}/chipper:scrape-${{ env.VERSION }} \
tools/scrape
docker push ${{ secrets.DOCKER_USERNAME }}/chipper:scrape-${{ env.VERSION }}