Update Node.js dockerfile (#805)

Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
This commit is contained in:
Matthew B White 2022-08-01 12:50:47 +01:00 committed by GitHub
parent 41717d76f2
commit 4bbffdf2f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1 @@
node_modules

View file

@ -7,6 +7,7 @@ WORKDIR /usr/src/app
# Copy node.js source and build, changing owner as well # Copy node.js source and build, changing owner as well
COPY --chown=node:node . /usr/src/app COPY --chown=node:node . /usr/src/app
ENV npm_config_cache=/usr/src/app
RUN npm ci && npm run package RUN npm ci && npm run package
@ -15,16 +16,17 @@ ARG CC_SERVER_PORT
# Setup tini to work better handle signals # Setup tini to work better handle signals
ENV TINI_VERSION v0.19.0 ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini ENV PLATFORM=amd64
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${PLATFORM} /tini
RUN chmod +x /tini RUN chmod +x /tini
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY --chown=node:node --from=builder /usr/src/app/dist ./dist COPY --chown=node:node --from=builder /usr/src/app/dist ./dist
COPY --chown=node:node --from=builder /usr/src/app/package.json ./ COPY --chown=node:node --from=builder /usr/src/app/package.json ./
COPY --chown=node:node --from=builder /usr/src/app/npm-shrinkwrap.json ./ COPY --chown=node:node --from=builder /usr/src/app/npm-shrinkwrap.json ./
COPY --chown=node:node docker/docker-entrypoint.sh /usr/src/app/docker-entrypoint.sh COPY --chown=node:node docker/docker-entrypoint.sh /usr/src/app/docker-entrypoint.sh
RUN npm ci --only=production
RUN npm ci --omit=dev && npm cache clean --force
ENV PORT $CC_SERVER_PORT ENV PORT $CC_SERVER_PORT
EXPOSE $CC_SERVER_PORT EXPOSE $CC_SERVER_PORT