Dockerfile.arm64 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. FROM alpine:3.20 AS builder
  2. RUN apk add --no-cache 'crystal=1.12.2-r0' shards sqlite-static yaml-static yaml-dev libxml2-static \
  3. zlib-static openssl-libs-static openssl-dev musl-dev xz-static
  4. ARG release
  5. WORKDIR /invidious
  6. COPY ./shard.yml ./shard.yml
  7. COPY ./shard.lock ./shard.lock
  8. RUN shards install --production
  9. COPY ./src/ ./src/
  10. # TODO: .git folder is required for building – this is destructive.
  11. # See definition of CURRENT_BRANCH, CURRENT_COMMIT and CURRENT_VERSION.
  12. COPY ./.git/ ./.git/
  13. # Required for fetching player dependencies
  14. COPY ./scripts/ ./scripts/
  15. COPY ./assets/ ./assets/
  16. COPY ./videojs-dependencies.yml ./videojs-dependencies.yml
  17. RUN crystal spec --warnings all \
  18. --link-flags "-lxml2 -llzma"
  19. RUN if [[ "${release}" == 1 ]] ; then \
  20. crystal build ./src/invidious.cr \
  21. --release \
  22. --static --warnings all \
  23. --link-flags "-lxml2 -llzma"; \
  24. else \
  25. crystal build ./src/invidious.cr \
  26. --static --warnings all \
  27. --link-flags "-lxml2 -llzma"; \
  28. fi
  29. FROM alpine:3.20
  30. RUN apk add --no-cache rsvg-convert ttf-opensans tini tzdata
  31. WORKDIR /invidious
  32. RUN addgroup -g 1000 -S invidious && \
  33. adduser -u 1000 -S invidious -G invidious
  34. COPY --chown=invidious ./config/config.* ./config/
  35. RUN mv -n config/config.example.yml config/config.yml
  36. RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: invidious-db/' config/config.yml
  37. COPY ./config/sql/ ./config/sql/
  38. COPY ./locales/ ./locales/
  39. COPY --from=builder /invidious/assets ./assets/
  40. COPY --from=builder /invidious/invidious .
  41. RUN chmod o+rX -R ./assets ./config ./locales
  42. EXPOSE 3000
  43. USER invidious
  44. ENTRYPOINT ["/sbin/tini", "--"]
  45. CMD [ "/invidious/invidious" ]