Skip to content

Commit fa5e734

Browse files
committed
add builders
1 parent 7694aa3 commit fa5e734

File tree

1 file changed

+56
-54
lines changed

1 file changed

+56
-54
lines changed
Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
name: Build Builder Images
2-
32
on:
43
workflow_dispatch: # Manual trigger
54
schedule:
65
- cron: '0 0 * * 0' # Weekly on Sunday
76
push:
87
paths:
98
- 'scripts/build-dependencies.sh'
10-
- 'build-docker/bookworm/Dockerfile.builder'
119

1210
jobs:
1311
build-builder:
@@ -36,64 +34,68 @@ jobs:
3634
- distro: ubuntu
3735
codename: trixie
3836
steps:
39-
- name: Setup QEMU
40-
uses: docker/setup-qemu-action@v3
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
40+
- name: Setup QEMU
41+
uses: docker/setup-qemu-action@v3
4142

42-
- name: Setup Buildx
43-
uses: docker/setup-buildx-action@v3
43+
- name: Setup Buildx
44+
uses: docker/setup-buildx-action@v3
4445

45-
- name: Login to GitHub Container Registry
46-
uses: docker/login-action@v3
47-
with:
48-
registry: ghcr.io
49-
username: ${{ github.actor }}
50-
password: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Login to GitHub Container Registry
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
5152

52-
- name: Create Dockerfile for this distro/codename
53-
run: |
54-
sed 's/FROM debian:bookworm/FROM ${{ matrix.distro }}:${{ matrix.codename }}/g' \
55-
build-docker/bookworm/Dockerfile.builder > Dockerfile.builder.${{ matrix.distro }}.${{ matrix.codename }}
53+
- name: Create inline Dockerfile
54+
run: |
55+
cat > Dockerfile.builder <<'EOF'
56+
ARG DISTRO=debian
57+
ARG CODENAME=bookworm
58+
FROM ${DISTRO}:${CODENAME}
5659
57-
- name: Build and push builder image
58-
uses: docker/build-push-action@v5
59-
with:
60-
context: .
61-
file: Dockerfile.builder.${{ matrix.distro }}.${{ matrix.codename }}
62-
platforms: linux/amd64,linux/arm64,linux/arm/v7
63-
push: true
64-
tags: |
65-
ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.distro }}-${{ matrix.codename }}
66-
ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.distro }}-${{ matrix.codename }}-${{ github.sha }}
67-
cache-from: type=gha
68-
cache-to: type=gha,mode=max
60+
# Install build dependencies
61+
RUN apt-get update && apt-get install -y \
62+
debhelper cmake g++ git pkg-config \
63+
libusb-1.0-0-dev libzmq3-dev libpq-dev \
64+
libssl-dev libsqlite3-dev zlib1g-dev \
65+
libairspy-dev libairspyhf-dev libhackrf-dev \
66+
&& rm -rf /var/lib/apt/lists/*
6967
70-
- name: Setup QEMU
71-
uses: docker/setup-qemu-action@v3
68+
# Create directory for pre-built dependencies
69+
RUN mkdir -p /deps
7270
73-
- name: Setup Buildx
74-
uses: docker/setup-buildx-action@v3
71+
# Copy build script
72+
COPY scripts/build-dependencies.sh /tmp/build-dependencies.sh
73+
RUN chmod +x /tmp/build-dependencies.sh
7574
76-
- name: Login to GitHub Container Registry
77-
uses: docker/login-action@v3
78-
with:
79-
registry: ghcr.io
80-
username: ${{ github.actor }}
81-
password: ${{ secrets.GITHUB_TOKEN }}
75+
# Build dependencies and store in /deps
76+
WORKDIR /tmp/build
77+
RUN /tmp/build-dependencies.sh /usr/lib/ais-catcher NMEA2000 /tmp/build && \
78+
mv rtl-sdr /deps/ && \
79+
mv rfone_host /deps/ && \
80+
mv NMEA2000 /deps/ && \
81+
rm -rf /tmp/build
8282
83-
- name: Create Dockerfile for this codename
84-
run: |
85-
sed 's/FROM debian:bookworm/FROM debian:${{ matrix.codename }}/g' \
86-
build-docker/bookworm/Dockerfile.builder > Dockerfile.builder.${{ matrix.codename }}
83+
# Set working directory for builds
84+
WORKDIR /workspace
85+
EOF
8786
88-
- name: Build and push builder image
89-
uses: docker/build-push-action@v5
90-
with:
91-
context: .
92-
file: Dockerfile.builder.${{ matrix.codename }}
93-
platforms: linux/amd64,linux/arm64,linux/arm/v7
94-
push: true
95-
tags: |
96-
ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.codename }}
97-
ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.codename }}-${{ github.sha }}
98-
cache-from: type=gha
99-
cache-to: type=gha,mode=max
87+
- name: Build and push builder image
88+
uses: docker/build-push-action@v5
89+
with:
90+
context: .
91+
file: Dockerfile.builder
92+
build-args: |
93+
DISTRO=${{ matrix.distro }}
94+
CODENAME=${{ matrix.codename }}
95+
platforms: linux/amd64,linux/arm64,linux/arm/v7
96+
push: true
97+
tags: |
98+
ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.distro }}-${{ matrix.codename }}
99+
ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.distro }}-${{ matrix.codename }}-${{ github.sha }}
100+
cache-from: type=gha,scope=${{ matrix.distro }}-${{ matrix.codename }}
101+
cache-to: type=gha,mode=max,scope=${{ matrix.distro }}-${{ matrix.codename }}

0 commit comments

Comments
 (0)