Created
March 10, 2023 15:06
-
-
Save saifuddin/04185087c6f1a236953bba5eb5794ceb to your computer and use it in GitHub Desktop.
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
# Dockerfile extending the generic Node image with application files for a | |
# single application. | |
FROM gcr.io/google_appengine/nodejs | |
ARG COMMIT=local | |
ARG TAG=local | |
# Check to see if the the version included in the base runtime satisfies | |
# '>=10.14', if not then do an npm install of the latest available | |
# version that satisfies it. | |
RUN /usr/local/bin/install_node '>=10.14' | |
COPY . /app/ | |
# You have to specify "--unsafe-perm" with npm install | |
# when running as root. Failing to do this can cause | |
# install to appear to succeed even if a preinstall | |
# script fails, and may have other adverse consequences | |
# as well. | |
# Build with dev to dist folder and delete after. | |
ENV NODE_ENV development | |
RUN npm ci --unsafe-perm && npm run build && rm -rf node_modules | |
ENV NODE_ENV production | |
# This command will also cat the npm-debug.log file after the | |
# build, if it exists. | |
RUN npm ci --unsafe-perm || \ | |
((if [ -f npm-debug.log ]; then \ | |
cat npm-debug.log; \ | |
fi) && false) | |
ENV NODE_PORT 8080 | |
EXPOSE 8080 | |
RUN mkdir -p public && echo "${TAG}: ${COMMIT}" > public/VERSION.txt | |
RUN echo "Wrote VERSION.txt -> ${TAG}: ${COMMIT}" | |
CMD npm start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment