-
-
Notifications
You must be signed in to change notification settings - Fork 295
52 lines (50 loc) · 1.42 KB
/
build-docker.yml
File metadata and controls
52 lines (50 loc) · 1.42 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
name: Build docker images
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
package:
- default
- cdn
- api
- gateway
- webrtc
- admin-api
- cdn-cs
- gateway-offload
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Build the docker image
run: nix build .#containers.x86_64-linux.docker.${{ matrix.package }}
- run: docker load < result
- name: downcase REPO
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image suffix
run: |
if [ "${{ matrix.package }}" = "default" ]; then
echo "SUFFIX=" >> $GITHUB_ENV
else
echo "SUFFIX=-${{ matrix.package }}" >> $GITHUB_ENV
fi
- name: Tag and push the image
run: |
IMAGE_ID=$(docker images spacebar-server-ts$SUFFIX --format '{{.ID}}')
docker tag $IMAGE_ID ghcr.io/$REPO$SUFFIX:latest
docker push ghcr.io/$REPO$SUFFIX:latest