Skip to content

Commit b67ed6f

Browse files
authored
Add docker builder workflow (#4)
1 parent 368d86c commit b67ed6f

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Publish docker images
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- 'v**'
9+
10+
jobs:
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
component: ["frontend", "proxy", "backend"]
17+
dockerhub_repo: ["consek"]
18+
steps:
19+
-
20+
name: Checkout
21+
uses: actions/checkout@v2
22+
-
23+
name: Docker meta
24+
id: meta
25+
uses: docker/metadata-action@v3
26+
with:
27+
images: ${{ matrix.dockerhub_repo }}/${{ matrix.component }}
28+
tags: |
29+
type=semver,pattern={{version}}
30+
type=semver,pattern={{raw}}
31+
type=sha,format=long
32+
latest
33+
-
34+
name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v1
36+
-
37+
name: Login to DockerHub
38+
uses: docker/login-action@v1
39+
with:
40+
username: ${{ secrets.DOCKERHUB_USERNAME }}
41+
password: ${{ secrets.DOCKERHUB_TOKEN }}
42+
-
43+
name: Build and push
44+
uses: docker/build-push-action@v2
45+
with:
46+
context: ${{ matrix.component }}/.
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
cache-from: ${{ matrix.dockerhub_repo }}/${{ matrix.component }}:sha-${{ github.sha }},${{ matrix.dockerhub_repo }}/${{ matrix.component }}:latest
50+
cache-to: type=inline

0 commit comments

Comments
 (0)