diff --git a/.github/workflows/docker-develop.yml b/.github/workflows/docker-develop.yml index d2cf4bf629..63dc940e24 100644 --- a/.github/workflows/docker-develop.yml +++ b/.github/workflows/docker-develop.yml @@ -31,3 +31,5 @@ jobs: push: true tags: misskey/misskey:develop labels: develop + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 47fe31bca7..3876b5f6ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,12 @@ ARG NODE_VERSION=18.13.0-bullseye FROM node:${NODE_VERSION} AS builder -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + rm -f /etc/apt/apt.conf.d/docker-clean \ + ; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \ + && apt-get update \ + && apt-get install -yqq --no-install-recommends \ build-essential RUN corepack enable @@ -16,7 +20,8 @@ COPY ["packages/backend/package.json", "./packages/backend/"] COPY ["packages/frontend/package.json", "./packages/frontend/"] COPY ["packages/sw/package.json", "./packages/sw/"] -RUN pnpm i --frozen-lockfile +RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \ + pnpm i --frozen-lockfile --aggregate-output COPY . ./ @@ -30,11 +35,13 @@ FROM node:${NODE_VERSION}-slim AS runner ARG UID="991" ARG GID="991" -RUN apt-get update \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + rm -f /etc/apt/apt.conf.d/docker-clean \ + ; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \ + && apt-get update \ && apt-get install -y --no-install-recommends \ ffmpeg tini \ - && apt-get -y clean \ - && rm -rf /var/lib/apt/lists/* \ && corepack enable \ && groupadd -g "${GID}" misskey \ && useradd -l -u "${UID}" -g "${GID}" -m -d /misskey misskey