From 758b7df400742d768abf0c005e6751d12c03e479 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 1 Nov 2022 17:34:26 +0000 Subject: [PATCH] dockerfile: Pass '-Ddisable_quic' to 'crystal build' (#3376) + use alpine 3.16 as a base like the crystal team --- .github/workflows/container-release.yml | 34 ++++++++++++++++++++++--- docker/Dockerfile | 11 ++++++-- docker/Dockerfile.arm64 | 9 ++++++- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index 7e427e6e..86aec94f 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -52,7 +52,7 @@ jobs: username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} - - name: Build and push Docker AMD64 image for Push Event + - name: Build and push Docker AMD64 image without QUIC for Push Event if: github.ref == 'refs/heads/master' uses: docker/build-push-action@v3 with: @@ -62,9 +62,11 @@ jobs: labels: quay.expires-after=12w push: true tags: quay.io/invidious/invidious:${{ github.sha }},quay.io/invidious/invidious:latest - build-args: release=1 + build-args: | + "release=1" + "disable_quic=1" - - name: Build and push Docker ARM64 image for Push Event + - name: Build and push Docker ARM64 image without QUIC for Push Event if: github.ref == 'refs/heads/master' uses: docker/build-push-action@v3 with: @@ -74,4 +76,30 @@ jobs: labels: quay.expires-after=12w push: true tags: quay.io/invidious/invidious:${{ github.sha }}-arm64,quay.io/invidious/invidious:latest-arm64 + build-args: | + "release=1" + "disable_quic=1" + + - name: Build and push Docker AMD64 image with QUIC for Push Event + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v3 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64 + labels: quay.expires-after=12w + push: true + tags: quay.io/invidious/invidious:${{ github.sha }}-quic,quay.io/invidious/invidious:latest-quic + build-args: release=1 + + - name: Build and push Docker ARM64 image with QUIC for Push Event + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v3 + with: + context: . + file: docker/Dockerfile.arm64 + platforms: linux/arm64/v8 + labels: quay.expires-after=12w + push: true + tags: quay.io/invidious/invidious:${{ github.sha }}-arm64-quic,quay.io/invidious/invidious:latest-arm64-quic build-args: release=1 diff --git a/docker/Dockerfile b/docker/Dockerfile index 1346f6eb..34549df1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,6 +2,7 @@ FROM crystallang/crystal:1.4.1-alpine AS builder RUN apk add --no-cache sqlite-static yaml-static ARG release +ARG disable_quic WORKDIR /invidious COPY ./shard.yml ./shard.yml @@ -23,7 +24,13 @@ COPY ./videojs-dependencies.yml ./videojs-dependencies.yml RUN crystal spec --warnings all \ --link-flags "-lxml2 -llzma" -RUN if [ "${release}" == 1 ] ; then \ +RUN if [[ "${release}" == 1 && "${disable_quic}" == 1 ]] ; then \ + crystal build ./src/invidious.cr \ + --release \ + -Ddisable_quic \ + --static --warnings all \ + --link-flags "-lxml2 -llzma"; \ + elif [[ "${release}" == 1 ]] ; then \ crystal build ./src/invidious.cr \ --release \ --static --warnings all \ @@ -35,7 +42,7 @@ RUN if [ "${release}" == 1 ] ; then \ fi -FROM alpine:latest +FROM alpine:3.16 RUN apk add --no-cache librsvg ttf-opensans WORKDIR /invidious RUN addgroup -g 1000 -S invidious && \ diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 index 35d3fa7b..ef3284b1 100644 --- a/docker/Dockerfile.arm64 +++ b/docker/Dockerfile.arm64 @@ -2,6 +2,7 @@ FROM alpine:3.16 AS builder RUN apk add --no-cache 'crystal=1.4.1-r0' shards sqlite-static yaml-static yaml-dev libxml2-dev zlib-static openssl-libs-static openssl-dev musl-dev ARG release +ARG disable_quic WORKDIR /invidious COPY ./shard.yml ./shard.yml @@ -23,7 +24,13 @@ COPY ./videojs-dependencies.yml ./videojs-dependencies.yml RUN crystal spec --warnings all \ --link-flags "-lxml2 -llzma" -RUN if [ ${release} == 1 ] ; then \ +RUN if [[ "${release}" == 1 && "${disable_quic}" == 1 ]] ; then \ + crystal build ./src/invidious.cr \ + --release \ + -Ddisable_quic \ + --static --warnings all \ + --link-flags "-lxml2 -llzma"; \ + elif [[ "${release}" == 1 ]] ; then \ crystal build ./src/invidious.cr \ --release \ --static --warnings all \