-
-
Notifications
You must be signed in to change notification settings - Fork 1k
126 lines (109 loc) · 3.8 KB
/
server.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Server release
on:
release:
types: [published]
pull_request:
paths:
- '.github/workflows/server.yml'
- 'apps/server/docker/*'
workflow_dispatch:
jobs:
build-server:
name: Build a docker image for spacedrive server
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Maximize build space
if: ${{ runner.os == 'Linux' }}
uses: easimon/maximize-build-space@master
with:
remove-codeql: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
remove-android: 'true'
overprovision-lvm: 'true'
remove-docker-images: 'true'
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Update Podman & crun
run: |
sudo apt-get remove crun podman
brew install crun podman
- name: Update buildah
shell: bash
run: |
set -euxo pipefail
wget -O- 'https://github.com/HeavenVolkoff/buildah-static/releases/latest/download/buildah-amd64.tar.gz' \
| sudo tar -xzf- -C /usr/local/bin
- name: Install netavark
shell: bash
run: |
set -euxo pipefail
sudo mkdir -p /usr/local/lib/podman
sudo wget -O- 'https://github.com/containers/netavark/releases/latest/download/netavark.gz' \
| gunzip | sudo dd status=none of=/usr/local/lib/podman/netavark
sudo chmod +x /usr/local/lib/podman/netavark
- name: Install passt
shell: bash
working-directory: /tmp
run: |
set -euxo pipefail
deb="$(
curl -SsL https://passt.top/builds/latest/x86_64 \
| grep -oP 'passt[^\.<>'\''"]+\.deb' | sort -u | head -n1
)"
curl -SsJLO "https://passt.top/builds/latest/x86_64/${deb}"
sudo dpkg -i "${deb}"
- name: Basic sanity check
run: |
crun --version
podman version
buildah --version
- name: Determine image name & tag
id: image_info
shell: bash
run: |
set -euxo pipefail
if [ "$GITHUB_EVENT_NAME" == "release" ]; then
IMAGE_TAG="${GITHUB_REF##*/}"
else
IMAGE_TAG="$(git rev-parse --short "$GITHUB_SHA")"
fi
IMAGE_TAG="${IMAGE_TAG,,}"
IMAGE_NAME="${GITHUB_REPOSITORY,,}/server"
echo "Building ${IMAGE_NAME}:${IMAGE_TAG}"
echo "tag=${IMAGE_TAG}" >> "$GITHUB_OUTPUT"
echo "name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
echo "repo=${GITHUB_REPOSITORY}" >> "$GITHUB_OUTPUT"
echo "repo_ref=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
- name: Build image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
tags: ${{ steps.image_info.outputs.tag }} ${{ github.event_name == 'release' && 'latest' || 'staging' }}
archs: amd64
image: ${{ steps.image_info.outputs.name }}
layers: 'false'
context: ./apps/server/docker
build-args: |
REPO=${{ steps.image_info.outputs.repo }}
REPO_REF=${{ steps.image_info.outputs.repo_ref }}
containerfiles: |
./apps/server/docker/Dockerfile
- name: Push image to ghcr.io
uses: redhat-actions/push-to-registry@v2
with:
tags: ${{ steps.build-image.outputs.tags }}
image: ${{ steps.build-image.outputs.image }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}