-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (53 loc) · 1.7 KB
/
build.yml
File metadata and controls
61 lines (53 loc) · 1.7 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
---
name: Build & Push Images
on:
push:
branches: ["**"]
paths-ignore:
- "k8s/**"
- "**.md"
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
REGISTRY: ${{ vars.REGISTRY || 'registry.wdr.io' }}
REPO: ${{ github.event.repository.name }}
jobs:
# ---------------------------------------------------------------
# Stage 1: Validate codebase.
# Simple project has no application code to lint — just verify
# the Dockerfile and static content are well-formed.
# ---------------------------------------------------------------
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: silta/nginx.Dockerfile
failure-threshold: error
# ---------------------------------------------------------------
# Stage 2: Build and push Docker image.
# ---------------------------------------------------------------
build-image:
name: Build & Push — nginx
runs-on: ubuntu-latest
needs: validate
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build & push image
uses: wunderio/silta-actions/build-push-image@v1
with:
image-name: nginx
dockerfile: silta/nginx.Dockerfile
registry: ${{ env.REGISTRY }}
registry-username: ${{ secrets.REGISTRY_USERNAME }}
registry-password: ${{ secrets.REGISTRY_PASSWORD }}