Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make final docker image lighter (#17933)
* Make final docker image lighter * Revert max-old-space-size change
- Loading branch information
1 parent
cb74665
commit 13a720b
Showing
1 changed file
with
6 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|