diff --git a/backend/Dockerfile b/backend/Dockerfile index 588a3867f..83af4317b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -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 diff --git a/webapp/Dockerfile b/webapp/Dockerfile index ceb485c8f..86dc9b661 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -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"] diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index 28a303bcd..58fa048b0 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -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