-
Notifications
You must be signed in to change notification settings - Fork 7
73 lines (68 loc) · 2.17 KB
/
Copy pathdocker.yml
File metadata and controls
73 lines (68 loc) · 2.17 KB
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
name: Docker
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
concurrency:
group: docker-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# ---------------------------------------------------------------------------
# Lint every Dockerfile with hadolint
# ---------------------------------------------------------------------------
hadolint:
name: Hadolint (${{ matrix.dockerfile }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dockerfile:
- Dockerfile
- server/api/Dockerfile
- docker/zebra/Dockerfile
steps:
- uses: actions/checkout@v7
- name: Install latest hadolint
run: |
curl -fsSL -o /usr/local/bin/hadolint \
https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
chmod +x /usr/local/bin/hadolint
hadolint --version
- name: Lint ${{ matrix.dockerfile }}
run: hadolint --config .hadolint.yaml "${{ matrix.dockerfile }}"
# ---------------------------------------------------------------------------
# Build the application images (web + api). No push.
# ---------------------------------------------------------------------------
build:
name: Build image (${{ matrix.name }})
runs-on: ubuntu-latest
needs: hadolint
strategy:
fail-fast: false
matrix:
include:
- name: web
context: .
dockerfile: Dockerfile
- name: api
context: server/api
dockerfile: server/api/Dockerfile
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- name: Build ${{ matrix.name }} image
uses: docker/build-push-action@v7
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: false
load: true
tags: cipherscan-${{ matrix.name }}:ci
build-args: |
GIT_COMMIT=${{ github.sha }}
cache-from: type=gha,scope=${{ matrix.name }}
cache-to: type=gha,scope=${{ matrix.name }},mode=max