This repository has been archived by the owner on Aug 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (65 loc) · 1.93 KB
/
build_docker.yaml
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
name: Build Docker images
on:
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
push:
branches:
- master
tags:
- v*
paths:
- 'dockerfiles/**'
jobs:
build:
runs-on: [self-hosted]
strategy:
matrix:
repo:
- consul-backup-gcs
- eks-container-insights
- fluentd
- actions-runner
- actions-runner-dind
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to Quay
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: quay.io/basisai/${{ matrix.repo }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Context for Buildx
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- 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: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./dockerfiles/${{ matrix.repo }}/
# platforms: linux/amd64,linux/arm64,linux/386
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache