dockerfile: compile openssl instead of using the one bundled on the crystal alpine image.

This commit is contained in:
Fijxu 2025-09-02 09:48:56 -04:00
parent fd8dc93569
commit b7a3f98fab
No known key found for this signature in database
GPG Key ID: 32C1DDF333EDA6A4

View File

@ -1,6 +1,20 @@
FROM crystallang/crystal:1.16.3-alpine AS builder
# https://github.com/openssl/openssl/releases/tag/openssl-3.5.2
ARG OPENSSL_VERSION='3.5.2'
FROM crystallang/crystal:1.16.3-alpine AS dependabot-crystal
FROM dependabot-crystal AS openssl-builder
RUN apk add curl perl linux-headers
WORKDIR /
ARG OPENSSL_VERSION
RUN curl -Ls "https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}.tar.gz" | tar xz
RUN cd openssl-${OPENSSL_VERSION} && ./Configure --openssldir=/etc/ssl && make -j
FROM dependabot-crystal AS builder
RUN apk add --no-cache sqlite-static yaml-static
RUN apk del openssl-dev openssl-libs-static
ARG release
@ -21,12 +35,18 @@ COPY ./videojs-dependencies.yml ./videojs-dependencies.yml
RUN crystal spec --warnings all \
--link-flags "-lxml2 -llzma"
ARG OPENSSL_VERSION
COPY --from=openssl-builder /openssl-${OPENSSL_VERSION} /openssl-${OPENSSL_VERSION}
RUN --mount=type=cache,target=/root/.cache/crystal if [[ "${release}" == 1 ]] ; then \
PKG_CONFIG_PATH=/openssl-${OPENSSL_VERSION} \
crystal build ./src/invidious.cr \
--release \
--static --warnings all \
--link-flags "-lxml2 -llzma"; \
else \
PKG_CONFIG_PATH=/openssl-${OPENSSL_VERSION} \
crystal build ./src/invidious.cr \
--static --warnings all \
--link-flags "-lxml2 -llzma"; \