From ea176aba8db05d3045b542bdee5f284869c07ac6 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sat, 16 Sep 2023 23:36:16 +0200 Subject: [PATCH] CI: Add docker file for arm64 cross-compilation --- .github/workflows/ci.yml | 2 +- docker/Dockerfile.arm64-musl-cross | 35 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile.arm64-musl-cross diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de538915..f7117ab5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,7 +117,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - file: docker/Dockerfile.arm64 + file: docker/Dockerfile.arm64-musl-cross platforms: linux/arm64/v8 build-args: release=0 diff --git a/docker/Dockerfile.arm64-musl-cross b/docker/Dockerfile.arm64-musl-cross new file mode 100644 index 00000000..5dec46db --- /dev/null +++ b/docker/Dockerfile.arm64-musl-cross @@ -0,0 +1,35 @@ +FROM alpine:3.18 AS builder + +RUN apk add --no-cache gcc make yaml-static libxml2-static sqlite-static zlib-static \ + xz-static openssl-libs-static openssl-dev pcre-dev gc-dev libevent-static musl-dev + +ARG release + +COPY ./Makefile . +COPY ./invidious-arm64-musl.o . + +RUN make invidious-arm64-musl STATIC=1 + + +FROM alpine:3.18 + +RUN apk add --no-cache librsvg ttf-opensans tini +WORKDIR /invidious + +RUN addgroup -g 1000 -S invidious && \ + adduser -u 1000 -S invidious -G invidious + +COPY --chown=invidious ./config/ ./config/ +RUN mv -n config/config.example.yml config/config.yml +RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: invidious-db/' config/config.yml + +COPY ./locales/ ./locales/ +COPY ./assets ./assets/ +RUN chmod o+rX -R ./assets ./config ./locales + +COPY --from=builder /invidious-arm64-musl . + +EXPOSE 3000 +USER invidious +ENTRYPOINT ["/sbin/tini", "--"] +CMD [ "/invidious/invidious-arm64-musl" ]