refactor(workflow): cache packages (#9206)

This commit is contained in:
Ulf Gebhardt 2026-02-11 01:46:04 +01:00 committed by GitHub
parent 9b6d2bbbba
commit 07cf1eacc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 11 deletions

View File

@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1
FROM node:25.6.0-alpine AS base
LABEL org.label-schema.name="ocelot.social:backend"
LABEL org.label-schema.description="Backend of the Social Network Software ocelot.social"
@ -28,13 +29,15 @@ ONBUILD COPY ./branding/email/ src/middleware/helpers/email/
ONBUILD COPY ./branding/middlewares/ src/middleware/branding/
ONBUILD COPY ./branding/data/ src/db/data
ONBUILD COPY ./branding/public/ public/
ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
ONBUILD RUN yarn run build
ONBUILD RUN mkdir /build
ONBUILD RUN cp -r ./build /build
ONBUILD RUN cp -r ./public /build
ONBUILD RUN cp -r ./package.json yarn.lock /build
ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
cd /build && yarn install --production=true --frozen-lockfile --non-interactive --cache-folder /yarn-cache
FROM build AS test
# required for the migrations

View File

@ -1,9 +1,11 @@
# syntax=docker/dockerfile:1
FROM node:25.6.0-alpine AS styleguide
RUN apk --no-cache add git python3 make g++
RUN mkdir -p /app
WORKDIR /app
COPY styleguide .
RUN yarn install --production=false --frozen-lockfile --non-interactive
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
RUN yarn run build:lib
FROM node:25.6.0-alpine AS ui-library
@ -11,7 +13,8 @@ RUN apk --no-cache add git python3 make g++
RUN mkdir -p /app
WORKDIR /app
COPY packages/ui .
RUN yarn install --production=false --frozen-lockfile --non-interactive
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
RUN yarn run build
FROM node:25.6.0-alpine AS base
@ -42,7 +45,8 @@ COPY webapp/ .
ONBUILD COPY webap[p]/brandin[g]/ .
ONBUILD COPY brandin[g]/ .
ONBUILD RUN tools/merge-locales.sh
ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
ONBUILD RUN yarn run build
ONBUILD RUN mkdir /build
ONBUILD RUN cp -r ./.nuxt /build
@ -56,13 +60,15 @@ ONBUILD RUN cp -r ./static /build
ONBUILD RUN cp -r ./locales /build
ONBUILD RUN cp -r ./package.json ./yarn.lock /build
ONBUILD RUN cp -r ./scripts /build
ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
cd /build && yarn install --production=true --frozen-lockfile --non-interactive --cache-folder /yarn-cache
FROM base AS test_build
ENV NODE_ENV=test
COPY webapp/. .
RUN tools/merge-locales.sh
RUN yarn install --production=false --frozen-lockfile --non-interactive
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
RUN yarn run build
RUN mkdir /build
RUN cp -r ./.nuxt /build
@ -73,7 +79,8 @@ RUN cp -r ./static /build
RUN cp -r ./locales /build
RUN cp -r ./package.json ./yarn.lock /build
RUN cp -r ./scripts /build
RUN cd /build && yarn install --frozen-lockfile --non-interactive
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
cd /build && yarn install --frozen-lockfile --non-interactive --cache-folder /yarn-cache
FROM test_build AS test
CMD ["/bin/bash", "-c", "yarn run dev"]

View File

@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1
FROM nginx:1.29.5-alpine AS base
LABEL org.label-schema.name="ocelot.social:maintenance"
LABEL org.label-schema.description="Maintenance page of the Social Network Software ocelot.social"
@ -13,7 +14,8 @@ RUN apk --no-cache add git python3 make g++
RUN mkdir -p /app
WORKDIR /app
COPY styleguide .
RUN yarn install --production=false --frozen-lockfile --non-interactive
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
RUN yarn run build:lib
FROM node:25.6.0-alpine AS ui-library
@ -21,7 +23,8 @@ RUN apk --no-cache add git python3 make g++
RUN mkdir -p /app
WORKDIR /app
COPY packages/ui .
RUN yarn install --production=false --frozen-lockfile --non-interactive
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
RUN yarn run build
FROM node:25.6.0-alpine AS build
@ -38,7 +41,8 @@ RUN rm -rf ./pages
ONBUILD COPY webap[p]/brandin[g]/ .
ONBUILD COPY brandin[g]/ .
ONBUILD RUN tools/merge-locales.sh
ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
ONBUILD RUN cp -r maintenance/source/* ./
ONBUILD RUN yarn run generate