Skip to content

Commit 30fb539

Browse files
committed
ci: speed up build with crystal arm64 binary
1 parent 66fd6db commit 30fb539

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

.github/workflows/publish.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ jobs:
2222
- name: Checkout
2323
uses: actions/checkout@v4
2424

25-
- name: Set up QEMU
26-
uses: docker/setup-qemu-action@v2
27-
2825
- name: Set up Docker Buildx
2926
uses: docker/setup-buildx-action@v2
3027

@@ -42,12 +39,16 @@ jobs:
4239
4340
- name: Build and push platform image
4441
uses: docker/build-push-action@v5
42+
env:
43+
CRYSTAL_WORKERS: ${{ matrix.platform == 'linux/amd64' && 4 || 2 }}
4544
with:
4645
context: .
4746
platforms: ${{ matrix.platform }}
4847
push: true
4948
tags: |
5049
sjdonado/bit:${{ github.event_name == 'release' && steps.version.outputs.version || 'latest' }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
50+
build-args: |
51+
TARGETARCH=${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
5152
cache-from: type=gha
5253
cache-to: type=gha,mode=max
5354

Dockerfile

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
1-
FROM alpine:edge AS build
1+
FROM debian:bookworm-slim AS build
22

3+
ARG TARGETARCH
34
ENV ENV=production
45
WORKDIR /usr/src/app
56

6-
RUN apk update && apk add --no-cache \
7+
RUN apt-get update && apt-get install -y \
8+
curl \
9+
gnupg \
10+
ca-certificates \
11+
&& mkdir -p /etc/apt/keyrings \
12+
&& curl -fsSL https://packagecloud.io/84codes/crystal/gpgkey | gpg --dearmor > /etc/apt/trusted.gpg.d/84codes_crystal.gpg \
13+
&& echo "deb [signed-by=/etc/apt/trusted.gpg.d/84codes_crystal.gpg] https://packagecloud.io/84codes/crystal/debian/ bookworm main" > /etc/apt/sources.list.d/84codes_crystal.list
14+
15+
RUN apt-get update && apt-get install -y \
716
crystal \
8-
shards \
9-
yaml-dev \
10-
sqlite-dev \
11-
openssl-dev
17+
libssl-dev \
18+
libyaml-dev \
19+
libsqlite3-dev \
20+
libevent-dev \
21+
&& rm -rf /var/lib/apt/lists/*
1222

1323
COPY . .
1424

15-
RUN shards install
16-
RUN shards build --release --no-debug
25+
RUN shards install --production
26+
RUN shards build --release --no-debug --progress --stats
1727

18-
FROM alpine:edge AS runtime
28+
FROM debian:bookworm-slim AS runtime
1929

2030
ENV ENV=production
2131
WORKDIR /usr/src/app
2232

23-
RUN apk add --no-cache \
24-
gc \
25-
pcre2 \
26-
libevent \
27-
yaml \
28-
sqlite-libs \
29-
openssl
33+
RUN apt-get update && apt-get install -y \
34+
libssl3 \
35+
libyaml-0-2 \
36+
libsqlite3-0 \
37+
libevent-2.1-7 \
38+
&& rm -rf /var/lib/apt/lists/*
3039

3140
RUN mkdir -p sqlite
3241

0 commit comments

Comments
 (0)