invidious-companion-patches/patches/0015-ci-improve-container-image-build-times.patch
Fijxu a47a5e5cd5
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m7s
add 0013-metrics-track-unidentified-innertube-errors.patch and 0014-metrics-add-more-errors.patch
2025-04-15 19:38:33 -04:00

52 lines
1.6 KiB
Diff

From 5538e30c2aff030b667fdf7e8d79d77978bc9ba5 Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Tue, 15 Apr 2025 19:20:52 -0400
Subject: [PATCH 15/15] ci: improve container image build times
---
.github/workflows/docker-build-push.yaml | 2 ++
Dockerfile | 11 ++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/docker-build-push.yaml b/.github/workflows/docker-build-push.yaml
index 8a79d77..69561fa 100644
--- a/.github/workflows/docker-build-push.yaml
+++ b/.github/workflows/docker-build-push.yaml
@@ -70,3 +70,5 @@ jobs:
platforms: linux/amd64,linux/arm64 # Build for multiple architectures
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/Dockerfile b/Dockerfile
index 4533e71..a0df4f6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -11,9 +11,6 @@ RUN mkdir -p /var/tmp/youtubei.js
RUN apt update && apt install -y curl
-COPY ./src/ /app/src/
-COPY deno.json /app/
-
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-$(dpkg --print-architecture) \
--output /tini \
&& chmod +x /tini
@@ -23,6 +20,14 @@ RUN arch=$(uname -m) && \
--output /thc \
&& chmod +x /thc
+COPY deno.json /app/
+COPY deno.lock /app/
+
+# Dependencies are cached on /deno-dir for the denoland/deno:debian image
+RUN --mount=type=cache,target=/deno-dir deno install
+
+COPY ./src/ /app/src/
+
RUN deno task compile
# Stage for creating the non-privileged user
--
2.49.0