-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (49 loc) · 1.59 KB
/
build-images-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
name: Push to GHCR
on:
push:
jobs:
build-image:
name: Build Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- Dockerfile: simple/Dockerfile
context: simple/
tag: simple
- Dockerfile: micro-service/Dockerfile.api
context: micro-service
tag: api
- Dockerfile: micro-service/Dockerfile.frontend
context: micro-service
tag: frontend
- Dockerfile: evil-tea/Dockerfile
context: evil-tea
tag: evil
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: qjoly
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Checkout code
uses: actions/checkout@v2
- name: set repository name to lowercase
run: |
echo "reponame=${reponame,,}" >>${GITHUB_ENV}
env:
reponame: '${{ github.repository }}'
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.reponame }}:${{ matrix.tag }}
platforms: linux/amd64,linux/arm64