Last active
June 11, 2021 21:15
-
-
Save unixfox/43353de784034a2437d64d749b86a282 to your computer and use it in GitHub Desktop.
aarch64/arm64 dockerfile for Invidious
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:edge AS lsquic-builder | |
RUN apk add --update --no-cache \ | |
tar \ | |
build-base \ | |
cmake \ | |
git \ | |
go \ | |
linux-headers \ | |
ninja \ | |
perl \ | |
bsd-compat-headers \ | |
zlib-dev \ | |
zlib-static \ | |
binutils \ | |
libevent-dev | |
WORKDIR /build | |
RUN git clone https://boringssl.googlesource.com/boringssl | |
WORKDIR /build/boringssl | |
RUN git checkout b117a3a0b7bd11fe6ebd503ec6b45d6b910b41a1 && \ | |
cmake -DCMAKE_BUILD_TYPE=Release -GNinja . && \ | |
ninja | |
WORKDIR /build | |
RUN git clone https://github.com/litespeedtech/lsquic.git | |
WORKDIR /build/lsquic | |
RUN git checkout f198a02df8d5629c9f40fff726081aeea0f1681c && \ | |
git submodule init && \ | |
git submodule update && \ | |
cmake -DBORINGSSL_DIR=../boringssl . && \ | |
make -j$(nproc) | |
WORKDIR /build/lsquic/dist | |
RUN ar -x ../../boringssl/ssl/libssl.a && \ | |
ar -x ../../boringssl/crypto/libcrypto.a && \ | |
ar -x ../src/liblsquic/liblsquic.a && \ | |
ar rc liblsquic.a *.o && \ | |
rm *.o && \ | |
strip --strip-unneeded liblsquic.a && \ | |
ranlib liblsquic.a | |
FROM alpine:edge AS invidious-builder | |
RUN apk add --update --no-cache \ | |
crystal shards \ | |
g++ \ | |
gc-dev \ | |
libxml2-dev \ | |
llvm10-static \ | |
llvm10-dev \ | |
make \ | |
musl-dev \ | |
openssl-dev \ | |
openssl-libs-static \ | |
zlib-static \ | |
zlib-dev \ | |
git \ | |
curl sqlite-static yaml-static \ | |
sqlite-dev yaml-dev | |
WORKDIR /invidious | |
COPY ./shard.yml ./shard.yml | |
COPY ./shard.lock ./shard.lock | |
RUN shards install | |
COPY --from=lsquic-builder /build/lsquic/dist/liblsquic.a ./lib/lsquic/src/lsquic/ext/liblsquic.a | |
COPY ./src/ ./src/ | |
# TODO: .git folder is required for building – this is destructive. | |
# See definition of CURRENT_BRANCH, CURRENT_COMMIT and CURRENT_VERSION. | |
COPY ./.git/ ./.git/ | |
RUN crystal build ./src/invidious.cr \ | |
--static --warnings all \ | |
--link-flags "-lxml2 -llzma" | |
FROM alpine:edge | |
RUN apk add --update --no-cache --force-overwrite \ | |
librsvg ttf-liberation | |
WORKDIR /invidious | |
RUN addgroup -g 1000 -S invidious && \ | |
adduser -u 1000 -S invidious -G invidious | |
COPY ./assets/ ./assets/ | |
COPY --chown=invidious ./config/config.* ./config/ | |
RUN mv -n config/config.example.yml config/config.yml | |
RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: postgres/' config/config.yml | |
COPY ./config/sql/ ./config/sql/ | |
COPY ./locales/ ./locales/ | |
COPY --from=invidious-builder /invidious/invidious . | |
RUN chmod o+rX -R ./assets ./config ./locales | |
EXPOSE 3000 | |
USER invidious | |
CMD [ "/invidious/invidious" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment