[docker] Utilize focus-production script

This commit is contained in:
Laura Hausmann 2023-11-06 21:51:43 +01:00
parent 9e53d46b71
commit 698584f7aa
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -4,7 +4,7 @@ FROM alpine:3.18 as build
WORKDIR /iceshrimp
# Install compilation dependencies
RUN apk add --no-cache --no-progress git alpine-sdk vips-dev python3 nodejs-current npm vips moreutils jq
RUN apk add --no-cache --no-progress git alpine-sdk vips-dev python3 nodejs-current npm vips
# Copy only the dependency-related files first, to cache efficiently
COPY package.json yarn.lock .pnp.cjs .pnp.loader.mjs ./
@ -33,8 +33,7 @@ RUN env NODE_ENV=production yarn build
RUN --mount=type=cache,target=/iceshrimp/.yarncache_focused cp -Tr .yarncache_focused .yarn
# Remove dev deps
RUN find packages package.json -name package.json | xargs -i sh -c "jq 'del(.devDependencies)' {} | sponge {}"
RUN yarn
RUN yarn focus-production
# Save focused yarn cache
RUN --mount=type=cache,target=/iceshrimp/.yarncache_focused rm -rf .yarncache/* && cp -Tr .yarn .yarncache_focused