forked from Ericsson/CodeCompass
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (89 loc) · 3.88 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Docker images
on:
workflow_dispatch:
workflow_call:
inputs:
tag-latest:
required: false
type: boolean
default: false
description: Tag the built image as latest
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
permissions: read-all
jobs:
docker-sqlite:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Branch name slug
uses: rlespinasse/github-slug-action@v4
- name: Branch name substring
uses: bhowell2/github-substring-action@v1
id: branch_substring
with:
value: ${{ env.GITHUB_REF_SLUG }}
index_of_str: "release-"
fail_if_not_found: false
default_return_value: ""
- name: Build images
run: |
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
docker build -t codecompass:dev -t modelcpp/codecompass:${BRANCH_PREFIX}dev --file docker/dev/Dockerfile .
docker build -t codecompass:runtime -t modelcpp/codecompass:${BRANCH_PREFIX}runtime-sqlite --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=sqlite .
docker build -t codecompass:web -t modelcpp/codecompass:${BRANCH_PREFIX}web-sqlite --file docker/web/Dockerfile --no-cache .
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push images
run: |
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
docker push modelcpp/codecompass:${BRANCH_PREFIX}dev
docker push modelcpp/codecompass:${BRANCH_PREFIX}runtime-sqlite
docker push modelcpp/codecompass:${BRANCH_PREFIX}web-sqlite
docker-pgsql:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Branch name slug
uses: rlespinasse/github-slug-action@v4
- name: Branch name substring
uses: bhowell2/github-substring-action@v1
id: branch_substring
with:
value: ${{ env.GITHUB_REF_SLUG }}
index_of_str: "release-"
fail_if_not_found: false
default_return_value: ""
- name: Build images
run: |
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
docker build -t codecompass:dev -t modelcpp/codecompass:${BRANCH_PREFIX}dev --file docker/dev/Dockerfile .
docker build -t codecompass:runtime -t modelcpp/codecompass:${BRANCH_PREFIX}runtime-pgsql --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=pgsql .
docker build -t codecompass:web -t modelcpp/codecompass:${BRANCH_PREFIX}web-pgsql --file docker/web/Dockerfile --no-cache .
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push images
run: |
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
docker push modelcpp/codecompass:${BRANCH_PREFIX}runtime-pgsql
docker push modelcpp/codecompass:${BRANCH_PREFIX}web-pgsql
- name: Tag and push latest image
if: ${{ inputs.tag-latest == 'true' }}
run: |
docker tag modelcpp/codecompass:runtime-pgsql modelcpp/codecompass:latest
docker push modelcpp/codecompass:latest