Skip to content

Commit dc077c8

Browse files
committed
feat: containarize for faster builds
1 parent 663e1b6 commit dc077c8

4 files changed

Lines changed: 72 additions & 25 deletions

File tree

.github/workflows/build-image.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build Builder Image
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
paths: ['docker/Dockerfile']
7+
workflow_dispatch:
8+
schedule:
9+
- cron: '0 0 * * 0' # Weekly
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository_owner }}/vup-builder
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Log in to the Container registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: |
39+
type=raw,value=latest,enable={{is_default_branch}}
40+
type=sha
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
file: docker/Dockerfile
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/build.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
if: needs.check-changes.outputs.should_run == 'true'
104104
runs-on: ubuntu-latest
105105
container:
106-
image: ghcr.io/void-linux/void-glibc:latest
106+
image: ghcr.io/VUP-Linux/vup-builder:latest
107107
options: --privileged
108108
strategy:
109109
matrix: ${{ fromJson(needs.check-changes.outputs.matrix) }}
@@ -113,21 +113,7 @@ jobs:
113113
cancel-in-progress: true
114114

115115
steps:
116-
- name: Pre-install Node Deps
117-
run: |
118-
xbps-install -Sy libstdc++ git
119-
120116
- name: Checkout VUP
121-
uses: actions/checkout@v4
122-
with:
123-
path: vup
124-
fetch-depth: 0
125-
126-
- name: Install Dependencies
127-
run: |
128-
xbps-install -Sy git curl bash python3 github-cli util-linux shadow findutils tar gzip
129-
130-
- name: Checkout void-packages
131117
uses: actions/checkout@v4
132118
with:
133119
repository: void-linux/void-packages
@@ -169,6 +155,8 @@ jobs:
169155
rm -f repodata
170156
171157
- name: Build Packages (Buffered)
158+
env:
159+
CATEGORY: ${{ matrix.category }}
172160
run: |
173161
cd void-packages
174162
# category is passed via env
@@ -206,7 +194,6 @@ jobs:
206194
GITHUB_REPOSITORY: ${{ github.repository }}
207195
CATEGORY: ${{ matrix.category }}
208196
run: |
209-
xbps-install -y ca-certificates
210197
cd void-packages/dist
211198
python3 ../../vup/vup/scripts/manage_release.py clean_remote
212199

.github/workflows/pr-check.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
needs: labeler
2727
container:
28-
image: ghcr.io/void-linux/void-glibc:latest
28+
image: ghcr.io/VUP-Linux/vup-builder:latest
2929
options: --privileged
3030
strategy:
3131
matrix:
@@ -42,14 +42,6 @@ jobs:
4242
cancel-in-progress: true
4343

4444
steps:
45-
- name: Pre-install Node Deps
46-
run: |
47-
xbps-install -Sy libstdc++ git
48-
49-
- name: Install Dependencies
50-
run: |
51-
xbps-install -Sy git curl bash util-linux shadow findutils tar gzip
52-
5345
- name: Checkout VUP
5446
uses: actions/checkout@v4
5547
with:

docker/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ghcr.io/void-linux/void-glibc:latest
2+
3+
# Update and install dependencies
4+
# We install all tools required by the CI workflows to avoid repeated installations
5+
RUN xbps-install -Syu xbps && \
6+
xbps-install -Sy \
7+
git \
8+
curl \
9+
bash \
10+
python3 \
11+
github-cli \
12+
util-linux \
13+
shadow \
14+
findutils \
15+
tar \
16+
gzip \
17+
libstdc++ \
18+
ca-certificates \
19+
&& rm -rf /var/cache/xbps/*

0 commit comments

Comments
 (0)