-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.build
More file actions
27 lines (21 loc) · 1.13 KB
/
Copy pathDockerfile.build
File metadata and controls
27 lines (21 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Using the Maven image with Eclipse Temurin JDK 11 as a base image
FROM maven:3.9.8-eclipse-temurin-11 as maven-java-node
# Setting the Maven configuration directory
ENV MAVEN_CONFIG=~/.m2
# Installing Node.js 18.16.1 and npm 9.5.1
RUN mkdir -p /usr/local/content/node
WORKDIR /usr/local/content/node
# Downloading and extracting Node.js and npm binaries
ADD https://nodejs.org/dist/v18.16.1/node-v18.16.1-linux-x64.tar.gz .
RUN tar -xzf node-v18.16.1-linux-x64.tar.gz \
&& ln -s /usr/local/content/node/node-v18.16.1-linux-x64/bin/node /usr/local/bin/node \
&& ln -s /usr/local/content/node/node-v18.16.1-linux-x64/bin/npm /usr/local/bin/npm \
&& chown -R root:root /usr/local/content/node \
&& rm -fR node-v18.16.1-linux-x64.tar.gz
# Define a new build stage for building the code based on the maven-java-node stage
FROM maven-java-node
# Create a directory for the application in the container
RUN mkdir -p /usr/local/content/app
WORKDIR /usr/local/content/app
# Define the default command to run when the container starts by copying war into dist
CMD mvn clean install -P${profile} && mkdir -p dist && cp -fr target/*.war dist/