From e4e0f5d9159c89da2dcce37deb9bbe2b9b53a9d1 Mon Sep 17 00:00:00 2001 From: Ng Heng Khai Date: Mon, 13 May 2024 04:12:15 +0800 Subject: [PATCH] Revert "Update Dockerfile" This reverts commit 5026defb44d32e30a1f73518c0faa9614cce2574. --- Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad6eec9..336ed07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,10 +41,19 @@ RUN ./mvnw clean verify -DskipTests # The base image to package. This is a multi-stage build using a new context. FROM eclipse-temurin:21-jdk-jammy -# Install Node.JS and NPM. +# Use use bash instead of sh from this point forward. +SHELL ["/bin/bash", "-c"] + +# Install Node.JS and NPM via NVM. +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \ + export NVM_DIR="$HOME/.nvm" && \ + [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \ + nvm install v20.13.1 && \ + nvm use v20.13.1 + # Install PostgreSQL and change PostgreSQL authentication to trust. # Install the PostgreSQL package. Remove the package lists to reduce the image size. -RUN apt-get update && apt-get install -y ca-certificates curl gnupg && mkdir -p /etc/apt/keyrings && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install -y nodejs postgresql && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y postgresql && rm -rf /var/lib/apt/lists/* # As a security best practice, switch to a non-root user with user privileges instead of root privileges. # The USER Dockerfile instruction sets the preferred user name (or UID) and optionally the user group (or GID) while running the image — and for any subsequent RUN, CMD, or ENTRYPOINT instructions.