From 61d49e3ef893f13e588020eca140c9a4b060683a Mon Sep 17 00:00:00 2001 From: Fijxu Date: Tue, 15 Apr 2025 19:48:26 -0400 Subject: [PATCH 15/20] ci: improve container image build times --- .github/workflows/docker-build-push.yaml | 2 ++ Dockerfile | 10 ++++++---- 2 files changed, 8 insertions(+), 4 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..bd43ac9 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,7 +20,12 @@ RUN arch=$(uname -m) && \ --output /thc \ && chmod +x /thc -RUN deno task compile +COPY deno.json /app/ +COPY deno.lock /app/ + +COPY ./src/ /app/src/ + +RUN --mount=type=cache,target=/deno-dir deno task compile # Stage for creating the non-privileged user FROM alpine:3.20 AS user-stage -- 2.49.0