-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (67 loc) · 1.92 KB
/
main.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: CI
on:
push:
branches: [main]
paths-ignore:
- ".gitignore"
- "LICENSE.md"
- "README.md"
pull_request:
branches: [main]
paths-ignore:
- ".gitignore"
- "LICENSE.md"
- "README.md"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Lint Dockerfiles
run: |
wget -O hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
mv hadolint /usr/local/bin/hadolint
chmod +x /usr/local/bin/hadolint
ls -la
hadolint --config .hadolint.yaml ./Dockerfiles/*
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./Dockerfiles/Dockerfile.drgon-postgres
image: ghcr.io/${{ github.repository }}
tag: postgres
- dockerfile: ./Dockerfiles/Dockerfile.drgon-server
image: ghcr.io/${{ github.repository }}
tag: server
permissions:
packages: write
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha,prefix=${{ matrix.tag }}-
type=raw,value=${{ matrix.tag }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: geovanni-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.docker_meta.outputs.tags }}