Skip to content

Commit

Permalink
fix build + update max-old-space-size
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiaifrim committed Jul 5, 2023
1 parent 17f245a commit bc9b40a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN runDeps="openssl ca-certificates patch gosu git make tmux locales-all" \

USER node
ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE
ARG MAX_OLD_SPACE_SIZE=8192
ARG MAX_OLD_SPACE_SIZE=1536
RUN yarn \
&& yarn build \
&& rm -rf /home/node/.cache \
Expand All @@ -28,7 +28,7 @@ RUN yarn \
&& rm -rf /app/.yarn/cache
USER root

EXPOSE 3000 3001 4000 4001
EXPOSE 3000 3001

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["yarn", "start:prod"]
31 changes: 12 additions & 19 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
#!/usr/bin/env bash
set -Ex

function apply_path {
mainjs=./build/server.js
bundlejs=./build/public/static/js/*.js
test -f $mainjs

echo "Check that we have API_PATH and API vars"
test -n "$API_PATH"

echo "Changing built files inplace"
sed -i "s#VOLTO_API_PATH#${API_PATH}#g" $mainjs
sed -i "s#VOLTO_API_PATH#${API_PATH}#g" $bundlejs
sed -i "s#VOLTO_INTERNAL_API_PATH#${INTERNAL_API_PATH}#g" $mainjs
sed -i "s#VOLTO_INTERNAL_API_PATH#${INTERNAL_API_PATH}#g" $bundlejs

echo "Zipping JS Files"
gzip -fk $mainjs
function apply_rebuild {
mkdir -p /app/src/addons
gosu node yarn develop
gosu node yarn
gosu node yarn build
}

# Should we monkey patch?
test -n "$API_PATH" && apply_path
# Should we re-build
test -n "$REBUILD" && apply_rebuild

if [[ "$1" == "yarn"* ]]; then
echo "Starting Volto"
exec gosu node "$@"
fi

echo "Starting Volto"
exec "$@"

0 comments on commit bc9b40a

Please sign in to comment.