Skip to content

Commit 04ed9c8

Browse files
committed
Multi-platform docker builds #731
1 parent 0c46cf3 commit 04ed9c8

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
- name: Earthly build, test
2828
run: earthly --org ontola --ci --sat henk -P +pipeline
2929
- name: Earthly build and push docker
30-
run: earthly --org ontola --ci --sat henk -P --push +docker --tags="${{ steps.meta.outputs.tags }}"
30+
run: earthly --org ontola --ci --sat henk -P --push +docker-all --tags="${{ steps.meta.outputs.tags }}"

Earthfile

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ build-all:
2020
BUILD +build # x86_64-unknown-linux-gnu
2121
BUILD +cross-build --TARGET=x86_64-unknown-linux-musl
2222
BUILD +cross-build --TARGET=armv7-unknown-linux-musleabihf
23+
BUILD +cross-build --TARGET=aarch64-unknown-linux-musl
2324
# Errors
2425
# BUILD +cross-build --TARGET=aarch64-apple-darwin
2526

2627
docker-all:
2728
BUILD --platform=linux/amd64 +docker-musl --TARGET=x86_64-unknown-linux-musl
2829
BUILD --platform=linux/arm/v7 +docker-musl --TARGET=armv7-unknown-linux-musleabihf
30+
BUILD --platform=linux/arm64/v8 +docker-musl --TARGET=aarch64-unknown-linux-musl
2931

3032
install:
3133
RUN apt-get update -qq
@@ -43,6 +45,8 @@ source:
4345
cross-build:
4446
FROM +source
4547
ARG --required TARGET
48+
# This does not yet cache properly
49+
# https://github.com/earthly/lib/issues/34
4650
WITH DOCKER
4751
RUN cross build --target $TARGET --release
4852
END
@@ -67,9 +71,10 @@ lint:
6771
DO rust+CARGO --args="clippy --no-deps --all-features --all-targets"
6872

6973
docker-musl:
70-
ARG tag="latest,sha-\$EARTHLY_GIT_SHORT_HASH"
74+
FROM alpine:3.18
75+
ARG tags="joepmeneer/atomic-server:develop"
7176
ARG --required TARGET
72-
COPY --chmod=0755 (+build/atomic-server --TARGET=${TARGET}) /atomic-server-bin
77+
COPY --chmod=0755 --platform=linux/amd64 (+cross-build/atomic-server --TARGET=${TARGET}) /atomic-server-bin
7378
RUN /atomic-server-bin --version
7479
# For a complete list of possible ENV vars or available flags, run with `--help`
7580
ENV ATOMIC_DATA_DIR="/atomic-storage/data"
@@ -78,24 +83,6 @@ docker-musl:
7883
EXPOSE 80
7984
VOLUME /atomic-storage
8085
ENTRYPOINT ["/atomic-server-bin"]
81-
82-
docker:
83-
FROM jeanblanchard/alpine-glibc:3.17.5
84-
ARG tags="joepmeneer/atomic-server:develop"
85-
# Some glibc deps are missing, installing it errors so ignore.
86-
RUN apk add gcompat 2>/dev/null || true
87-
COPY --chmod=0755 +build/atomic-server /atomic-server-bin
88-
RUN /atomic-server-bin --version
89-
# For a complete list of possible ENV vars or available flags, run with `--help`
90-
ENV ATOMIC_STORE_PATH="/atomic-storage/db"
91-
ENV ATOMIC_CONFIG_PATH="/atomic-storage/config.toml"
92-
ENV ATOMIC_PORT="80"
93-
EXPOSE 80
94-
VOLUME /atomic-storage
95-
ENTRYPOINT ["/atomic-server-bin"]
96-
# Push to github container registry
97-
SAVE IMAGE --push ghcr.io/atomicdata-dev/atomic-server:${tag}
98-
# Push to dockerhub
9986
SAVE IMAGE --push ${tags}
10087

10188
setup-playwright:

0 commit comments

Comments
 (0)