-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (83 loc) · 2.94 KB
/
build-docker-images.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
76
77
78
79
80
81
82
83
84
85
86
87
name: build-docker-images
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
jobs:
build-alpine-image:
runs-on: ubuntu-latest
environment: prod
strategy:
matrix:
bob_key_size: [8, 16]
steps:
- name: Checks-out repository
uses: actions/checkout@v2
- name: Set env
run: |
echo "VERSION=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g' | sed -e 's/-/./g')" >> $GITHUB_ENV
echo "BOB_COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: qoollo/bob
tags: |
${{ env.VERSION }}-key${{ matrix.bob_key_size }}-alpine3.12
${{ env.VERSION }}-key${{ matrix.bob_key_size }}
${{ env.VERSION }},enable=${{ matrix.bob_key_size == 8 }}
nightly,enable=${{ matrix.bob_key_size == 8 }}
latest,enable=${{ matrix.bob_key_size == 8 && ! contains(env.VERSION, 'alpha') }}
- name: Build and push alpine image
uses: docker/build-push-action@v2
with:
context: .
file: dockerfiles/alpine/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT_HASH=${{ env.BOB_COMMIT_HASH }}
KEY_SIZE=${{ matrix.bob_key_size }}
build-ubuntu-image:
runs-on: ubuntu-latest
environment: prod
strategy:
matrix:
bob_key_size: [8, 16]
steps:
- name: Checks-out repository
uses: actions/checkout@v2
- name: Set env
run: |
echo "VERSION=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g' | sed -e 's/-/./g')" >> $GITHUB_ENV
echo "BOB_COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: qoollo/bob
tags: |
${{ env.VERSION }}-key${{ matrix.bob_key_size }}-ubuntu20.04
- name: Build and push ubuntu image
uses: docker/build-push-action@v2
with:
context: .
file: dockerfiles/ubuntu/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT_HASH=${{ env.BOB_COMMIT_HASH }}
KEY_SIZE=${{ matrix.bob_key_size }}