Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
Updated to install Node.JS.
  • Loading branch information
nhkhai committed May 12, 2024
1 parent 73e21b1 commit aace32a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# The base image to build. Define the context name for the build stage.
FROM eclipse-temurin:21-jdk-alpine as builder

# The Node.JS build work directory.
RUN apk add libstdc++
WORKDIR /opt
RUN wget $NODE_PACKAGE_URL
RUN mkdir -p /opt/nodejs
RUN tar -zxvf *.tar.gz --directory /opt/nodejs --strip-components=1
RUN rm *.tar.gz
RUN ln -s /opt/nodejs/bin/node /usr/local/bin/node
RUN ln -s /opt/nodejs/bin/npm /usr/local/bin/npm
RUN npm install -g [email protected]

# The build work directory.
WORKDIR /opt/app

# The Node.js version to install.
ENV NODE_PACKAGE_URL https://unofficial-builds.nodejs.org/download/release/v20.13.1/node-v20.13.1-linux-x64-musl.tar.gz

# Copy the source code into the Docker image to be used for compiling.
COPY .mvn/ .mvn
COPY mvnw pom.xml ./
Expand All @@ -27,6 +41,9 @@ 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 via NVM.
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && source ~/.bashrc && 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 postgresql && rm -rf /var/lib/apt/lists/*
Expand Down

0 comments on commit aace32a

Please sign in to comment.