-
-
Notifications
You must be signed in to change notification settings - Fork 57
113 lines (103 loc) · 3.79 KB
/
build_and_push.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
107
108
109
110
111
112
113
name: Build and Push
on:
push:
branches:
- master
tags:
- "v*.*.*"
jobs:
build_and_push:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
TAG="latest"
COMMIT="commit-$(git rev-parse --short ${{ github.sha }})"
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/v}
fi
echo "docker_tag=${TAG}" >> $GITHUB_OUTPUT
echo "docker_commit=${COMMIT}" >> $GITHUB_OUTPUT
git submodule update --init --recursive --depth 1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to dockerhub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Application
- name: Docker Test Application
id: docker_test_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-app
file: ./docker-app/Dockerfile
- name: Docker Build and Push Application
id: docker_build_and_push_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: webserver_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_commit }}
- name: Docker Build and Push Worker
id: docker_build_and_push_worker
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: worker_wrapper_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_commit }}
# QGIS
- name: Docker Test QGIS
id: docker_test_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
- name: Docker Build and Push QGIS
id: docker_build_and_push_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_commit }}
# Nginx
- name: Docker Build and Push nginx
id: docker_build_and_push_nginx
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-nginx
file: ./docker-nginx/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-nginx:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-nginx:${{ steps.prepare.outputs.docker_commit }}