-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize Dockerfile to reduce image size
- Loading branch information
1 parent
2c8729f
commit bfaaf6e
Showing
1 changed file
with
19 additions
and
12 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 |
---|---|---|
@@ -1,28 +1,35 @@ | ||
# Based on https://github.com/plone/volto/blob/master/entrypoint.sh | ||
FROM node:12-stretch-slim | ||
|
||
RUN apt-get update && apt-get install -y git | ||
|
||
COPY . /opt/frontend/ | ||
RUN chown -R node /opt/frontend/ | ||
RUN rm -rf /opt/frontend/src/addons/* | ||
|
||
|
||
# Update apt packages | ||
RUN runDeps="openssl ca-certificates patch git" \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends $runDeps \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& chown -R node /opt/frontend/ \ | ||
&& rm -rf /opt/frontend/src/addons/* \ | ||
&& cd /opt/frontend \ | ||
&& npm install -g mrs-developer | ||
|
||
WORKDIR /opt/frontend/ | ||
RUN npm install -g mrs-developer | ||
|
||
USER node | ||
|
||
ARG MAX_OLD_SPACE_SIZE=8192 | ||
ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE | ||
|
||
RUN cd /opt/frontend | ||
|
||
RUN yarn develop | ||
RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn | ||
|
||
RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build \ | ||
RUN cd /opt/frontend \ | ||
&& yarn develop \ | ||
&& RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn \ | ||
&& RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build \ | ||
&& rm -rf /home/node/.cache | ||
|
||
EXPOSE 3000 3001 4000 4001 | ||
|
||
ENTRYPOINT ["/opt/frontend/entrypoint-prod.sh"] | ||
CMD ["yarn", "start:prod"] | ||
USER root | ||
USER root |