mirror of https://github.com/Chocobozzz/PeerTube
Faster CI docker build
parent
3b5b050a98
commit
dcfd83350a
|
@ -24,9 +24,9 @@ jobs:
|
||||||
# FIXME: https://github.com/actions/checkout/issues/290
|
# FIXME: https://github.com/actions/checkout/issues/290
|
||||||
git fetch --force --tags
|
git fetch --force --tags
|
||||||
|
|
||||||
one="{ \"file\": \"./support/docker/production/Dockerfile.bookworm\", \"ref\": \"develop\", \"tags\": \"chocobozzz/peertube:develop-bookworm\" }"
|
one="{ \"build-peertube\": true, \"file\": \"./support/docker/production/Dockerfile.bookworm\", \"ref\": \"develop\", \"tags\": \"chocobozzz/peertube:develop-bookworm\" }"
|
||||||
two="{ \"file\": \"./support/docker/production/Dockerfile.bookworm\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube:production-bookworm,chocobozzz/peertube:$(git describe --abbrev=0)-bookworm\" }"
|
two="{ \"build-peertube\": true, \"file\": \"./support/docker/production/Dockerfile.bookworm\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube:production-bookworm,chocobozzz/peertube:$(git describe --abbrev=0)-bookworm\" }"
|
||||||
three="{ \"file\": \"./support/docker/production/Dockerfile.nginx\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube-webserver:latest\" }"
|
three="{ \"build-peertube\": false, \"file\": \"./support/docker/production/Dockerfile.nginx\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube-webserver:latest\" }"
|
||||||
|
|
||||||
matrix="[$one,$two,$three]"
|
matrix="[$one,$two,$three]"
|
||||||
echo "matrix={\"include\":$matrix}" >> $GITHUB_OUTPUT
|
echo "matrix={\"include\":$matrix}" >> $GITHUB_OUTPUT
|
||||||
|
@ -43,30 +43,41 @@ jobs:
|
||||||
name: ${{ matrix.tags }}
|
name: ${{ matrix.tags }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout develop
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ matrix.ref }}
|
||||||
|
|
||||||
|
- uses: './.github/actions/reusable-prepare-peertube-build'
|
||||||
|
if: ${{ matrix.build-peertube }}
|
||||||
|
with:
|
||||||
|
node-version: '18.x'
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
if: ${{ matrix.build-peertube }}
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
-
|
|
||||||
name: Checkout develop
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ matrix.ref }}
|
|
||||||
-
|
-
|
||||||
name: Docker build
|
name: Docker build
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: '.'
|
context: '.'
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
file: ${{ matrix.file }}
|
file: ${{ matrix.file }}
|
||||||
tags: ${{ matrix.tags }}
|
tags: ${{ matrix.tags }}
|
||||||
|
build-args: ALREADY_BUILT=1
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
FROM node:18-bookworm-slim
|
FROM node:18-bookworm-slim
|
||||||
|
|
||||||
|
ARG ALREADY_BUILT=0
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install -y --no-install-recommends openssl ffmpeg python3 ca-certificates gnupg gosu build-essential curl git \
|
&& apt install -y --no-install-recommends openssl ffmpeg python3 python3-pip ca-certificates gnupg gosu build-essential curl git \
|
||||||
&& gosu nobody true \
|
&& gosu nobody true \
|
||||||
&& rm /var/lib/apt/lists/* -fR
|
&& rm /var/lib/apt/lists/* -fR
|
||||||
|
|
||||||
|
@ -17,12 +19,16 @@ WORKDIR /app
|
||||||
USER peertube
|
USER peertube
|
||||||
|
|
||||||
# Install manually client dependencies to apply our network timeout option
|
# Install manually client dependencies to apply our network timeout option
|
||||||
RUN cd client && yarn install --pure-lockfile --network-timeout 1200000 && cd ../ \
|
RUN if [ "${ALREADY_BUILT}" = 0 ]; then \
|
||||||
|
cd client && yarn install --pure-lockfile --network-timeout 1200000 && cd ../ \
|
||||||
&& yarn install --pure-lockfile --network-timeout 1200000 \
|
&& yarn install --pure-lockfile --network-timeout 1200000 \
|
||||||
&& npm run build \
|
&& npm run build; \
|
||||||
&& rm -r ./node_modules ./client/node_modules ./client/.angular \
|
else \
|
||||||
&& yarn install --pure-lockfile --production --network-timeout 1200000 --network-concurrency 20 \
|
echo "Do not build application inside Docker because of ALREADY_BUILT build argument"; \
|
||||||
&& yarn cache clean
|
fi; \
|
||||||
|
rm -rf ./node_modules ./client/node_modules ./client/.angular \
|
||||||
|
&& yarn install --pure-lockfile --production --network-timeout 1200000 --network-concurrency 20 \
|
||||||
|
&& yarn cache clean
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue