Skip to content

Commit

Permalink
Make final docker image lighter (#17933)
Browse files Browse the repository at this point in the history
* Make final docker image lighter

* Revert max-old-space-size change
  • Loading branch information
rijkvanzanten committed Mar 24, 2023
1 parent cb74665 commit 13a720b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Dockerfile
Expand Up @@ -19,13 +19,14 @@ FROM workspace AS pruned
WORKDIR /workspace
ENV NODE_OPTIONS=--max-old-space-size=8192

RUN pnpm --recursive run build \
&& pnpm --filter directus deploy --prod pruned \
&& cd pruned \
RUN pnpm --recursive --workspace-concurrency=1 run build
RUN pnpm --filter directus deploy --prod pruned
RUN cd pruned \
&& pnpm pack \
&& tar -zxvf *.tgz package/package.json \
&& mv package/package.json package.json \
&& rm -r *.tgz package
&& rm -r *.tgz package \
&& mkdir database extensions uploads

####################################################################################################
## Create Production Image
Expand All @@ -43,15 +44,7 @@ ENV STORAGE_LOCAL_ROOT="/directus/uploads"
ENV NODE_ENV="production"
ENV NPM_CONFIG_UPDATE_NOTIFIER="false"

COPY --from=pruned /workspace/pruned/cli.js cli.js
COPY --from=pruned /workspace/pruned/dist dist
COPY --from=pruned /workspace/pruned/package.json package.json
COPY --from=pruned /workspace/pruned/node_modules node_modules

RUN mkdir /directus/database /directus/extensions /directus/uploads \
&& chown -R node:node /directus \
&& corepack enable \
&& corepack prepare [email protected] --activate
COPY --from=pruned --chown=node:node /workspace/pruned .

VOLUME /directus/database
VOLUME /directus/extensions
Expand Down

0 comments on commit 13a720b

Please sign in to comment.