-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (58 loc) · 2.04 KB
/
Copy pathci.yml
File metadata and controls
66 lines (58 loc) · 2.04 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
name: CI - Build Containers
on:
push:
branches: ['main', 'dev']
pull_request:
branches: ['main', 'dev']
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
validate-compose:
name: Validate docker-compose configuration
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Ensure .env for docker-compose
run: |
if [ -f .env ]; then
echo ".env already exists"
elif [ -f .env.example ]; then
cp .env.example .env
else
touch .env
fi
- name: Validate docker-compose.yaml
run: docker compose -f docker-compose.yaml config -q
build-images:
name: Build Docker images
needs: validate-compose
runs-on: ubuntu-latest
strategy:
# Realistically, in production, `fail-fast` should be true,
# but we want to see every issue during these early stages of implementing
fail-fast: false
matrix:
include:
- name: server
context: server
dockerfile: server/Dockerfile
- name: client
context: client
dockerfile: client/Dockerfile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build ${{ matrix.name }} image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
push: false
tags: ghcr.io/${{ github.repository }}:${{ matrix.name }}-ci
cache-from: type=gha
cache-to: type=gha,mode=max