From 17bef91e1fb3aa5e0f0b7d2a752dbc32b977d8b2 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 18 Oct 2023 10:12:58 -0700 Subject: [PATCH] Return back to alpine node base image This commit resolves the EACCES issue we were previously encountering in a63e80a and allows us to return to using alpine as our base container image. This will allow us to have more direct control over the version of node running. Signed-off-by: Jeremy Ho --- Dockerfile | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 66ca2b0a..25ff4efa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,20 @@ -# FROM docker.io/node:16.15.0-alpine # Last known working alpine image +FROM docker.io/node:18.18.2-alpine -# RedHat Image Catalog references -# https://catalog.redhat.com/software/containers/ubi9/nodejs-18/62e8e7ed22d1d3c2dfe2ca01 -# https://catalog.redhat.com/software/containers/ubi9/nodejs-18-minimal/62e8e919d4f57d92a9dee838 - -# -# Build the application -# -FROM registry.access.redhat.com/ubi9/nodejs-18:1-70.1695740477 as builder - -ENV NO_UPDATE_NOTIFIER=true +ARG APP_ROOT=/opt/app-root/src +ENV APP_PORT=8080 \ + NO_UPDATE_NOTIFIER=true +WORKDIR ${APP_ROOT} -USER 0 -COPY . /tmp/src -WORKDIR /tmp/src/app -RUN chown -R 1001:0 /tmp/src +# NPM Permission Fix +RUN mkdir -p /.npm +RUN chown -R 1001:0 /.npm +# Install Application +COPY . ${APP_ROOT} +RUN chown -R 1001:0 ${APP_ROOT} USER 1001 +WORKDIR ${APP_ROOT}/app RUN npm ci --omit=dev -# -# Create the final container image -# -FROM registry.access.redhat.com/ubi9/nodejs-18-minimal:1-74.1695740475 - -ENV APP_PORT=3000 \ - NO_UPDATE_NOTIFIER=true - -COPY --from=builder /tmp/src ${HOME} -WORKDIR ${HOME}/app - EXPOSE ${APP_PORT} CMD ["npm", "run", "start"]