Make building in release mode optional (#2368)

This commit is contained in:
syeopite 2021-09-01 11:24:17 +00:00 committed by GitHub
parent a1001ada47
commit dd141daefd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 9 deletions

View File

@ -86,6 +86,9 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build Docker - name: Build Docker
run: docker-compose build --build-arg release=0
- name: Run Docker
run: docker-compose up -d run: docker-compose up -d
- name: Test Docker - name: Test Docker
@ -112,6 +115,7 @@ jobs:
context: . context: .
file: docker/Dockerfile.arm64 file: docker/Dockerfile.arm64
platforms: linux/arm64/v8 platforms: linux/arm64/v8
build-args: release=0
- name: Test Docker - name: Test Docker
run: while curl -Isf http://localhost:3000; do sleep 1; done run: while curl -Isf http://localhost:3000; do sleep 1; done

View File

@ -40,6 +40,7 @@ jobs:
labels: quay.expires-after=12w labels: quay.expires-after=12w
push: true push: true
tags: quay.io/invidious/invidious:${{ github.sha }},quay.io/invidious/invidious:latest tags: quay.io/invidious/invidious:${{ github.sha }},quay.io/invidious/invidious:latest
build-args: release=1
- name: Build and push Docker ARM64 image for Push Event - name: Build and push Docker ARM64 image for Push Event
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
@ -51,3 +52,4 @@ jobs:
labels: quay.expires-after=12w labels: quay.expires-after=12w
push: true push: true
tags: quay.io/invidious/invidious:${{ github.sha }}-arm64,quay.io/invidious/invidious:latest-arm64 tags: quay.io/invidious/invidious:${{ github.sha }}-arm64,quay.io/invidious/invidious:latest-arm64
build-args: release=1

View File

@ -1,6 +1,8 @@
FROM crystallang/crystal:1.1.1-alpine AS builder FROM crystallang/crystal:1.1.1-alpine AS builder
RUN apk add --no-cache sqlite-static yaml-static RUN apk add --no-cache sqlite-static yaml-static
ARG release
WORKDIR /invidious WORKDIR /invidious
COPY ./shard.yml ./shard.yml COPY ./shard.yml ./shard.yml
COPY ./shard.lock ./shard.lock COPY ./shard.lock ./shard.lock
@ -16,10 +18,17 @@ COPY ./.git/ ./.git/
RUN crystal spec --warnings all \ RUN crystal spec --warnings all \
--link-flags "-lxml2 -llzma" --link-flags "-lxml2 -llzma"
RUN crystal build ./src/invidious.cr \ RUN if [ ${release} == 1 ] ; then \
--release \ crystal build ./src/invidious.cr \
--static --warnings all \ --release \
--link-flags "-lxml2 -llzma" --static --warnings all \
--link-flags "-lxml2 -llzma"; \
else \
crystal build ./src/invidious.cr \
--static --warnings all \
--link-flags "-lxml2 -llzma"; \
fi
FROM alpine:latest FROM alpine:latest
RUN apk add --no-cache librsvg ttf-opensans RUN apk add --no-cache librsvg ttf-opensans

View File

@ -1,6 +1,8 @@
FROM alpine:3.14 AS builder FROM alpine:3.14 AS builder
RUN apk add --no-cache 'crystal<2' shards sqlite-static yaml-static yaml-dev libxml2-dev zlib-static openssl-libs-static openssl-dev musl-dev RUN apk add --no-cache 'crystal<2' shards sqlite-static yaml-static yaml-dev libxml2-dev zlib-static openssl-libs-static openssl-dev musl-dev
ARG release
WORKDIR /invidious WORKDIR /invidious
COPY ./shard.yml ./shard.yml COPY ./shard.yml ./shard.yml
COPY ./shard.lock ./shard.lock COPY ./shard.lock ./shard.lock
@ -16,10 +18,16 @@ COPY ./.git/ ./.git/
RUN crystal spec --warnings all \ RUN crystal spec --warnings all \
--link-flags "-lxml2 -llzma" --link-flags "-lxml2 -llzma"
RUN crystal build ./src/invidious.cr \ RUN if [ ${release} == 1 ] ; then \
--release \ crystal build ./src/invidious.cr \
--static --warnings all \ --release \
--link-flags "-lxml2 -llzma" --static --warnings all \
--link-flags "-lxml2 -llzma"; \
else \
crystal build ./src/invidious.cr \
--static --warnings all \
--link-flags "-lxml2 -llzma"; \
fi
FROM alpine:latest FROM alpine:latest
RUN apk add --no-cache librsvg ttf-opensans RUN apk add --no-cache librsvg ttf-opensans