Skip to content

Commit

Permalink
Upgrade to newer node and nginx in the Dockerfile
Browse files Browse the repository at this point in the history
Python is installed because node-gyp needs it. Also node is only version
14 because the node-gyp version we have doesn't work with node 16.
  • Loading branch information
mikkokeskinen authored and henrinie-nc committed Jan 8, 2024
1 parent 65760a7 commit 4558318
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# ===============================================
FROM helsinkitest/node:10-slim as appbase
FROM node:14-slim AS appbase
# ===============================================

RUN groupadd -g 1001 appuser \
&& useradd --create-home --no-log-init -u 1001 -g 1001 appuser

RUN mkdir /app
RUN chown -R appuser:appuser /app

WORKDIR /app

# Offical image has npm log verbosity as info. More info - https://github.com/nodejs/docker-node#verbosity
ENV NPM_CONFIG_LOGLEVEL warn

Expand All @@ -27,14 +36,18 @@ COPY package*.json *yarn* ./
ENV PATH /app/node_modules/.bin:$PATH

USER root
RUN bash /tools/apt-install.sh build-essential
RUN apt-get update
RUN apt-get install -y --no-install-recommends build-essential python3

USER appuser
RUN yarn config set network-timeout 300000
RUN yarn && yarn cache clean --force

USER root
RUN bash /tools/apt-cleanup.sh build-essential
RUN apt-get remove -y build-essential
RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
RUN rm -rf /var/lib/apt/lists/*
RUN rm -rf /var/cache/apt/archives

# =============================
FROM appbase as development
Expand All @@ -58,7 +71,7 @@ COPY . /app
RUN yarn compile

# =============================
FROM registry.access.redhat.com/ubi8/nginx-118 as production
FROM registry.access.redhat.com/ubi8/nginx-120 as production
# =============================

USER root
Expand Down

0 comments on commit 4558318

Please sign in to comment.