-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (49 loc) · 1.88 KB
/
container_workflows.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
# This is a workflow to build images
name: Build Docker Images
on: [push]
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
strategy:
matrix:
target: [frontend, frontend-armv7, backend, backend-armv7]
include:
- target: frontend
platforms: linux/amd64,linux/arm64
dockerfile: ./frontend.Dockerfile
tag: docker.io/groundlight/monitoring-notification-server-frontend:latest
- target: frontend-armv7
platforms: linux/arm/v7
dockerfile: ./frontend-armv7.Dockerfile
tag: docker.io/groundlight/monitoring-notification-server-frontend:armv7-latest
- target: backend
platforms: linux/amd64,linux/arm64
dockerfile: ./backend.Dockerfile
tag: docker.io/groundlight/monitoring-notification-server-backend:latest
- target: backend-armv7
platforms: linux/arm/v7
dockerfile: ./backend-armv7.Dockerfile
tag: docker.io/groundlight/monitoring-notification-server-backend:armv7-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
registry: docker.io
- name: Build Image
uses: docker/build-push-action@v3
with:
context: .
tags: ${{ matrix.tag }}
platforms: ${{ matrix.platforms }}
file: ${{ matrix.dockerfile }}
# push if the target is main
push: ${{ github.ref == 'refs/heads/main' }}
cache-from: type=gha,scope=${{ matrix.target }}
cache-to: type=gha,scope=${{ matrix.target }},mode=max