-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (25 loc) · 1005 Bytes
/
Dockerfile
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
28
29
30
31
32
33
34
# User used in local builds to access github packages
ARG GITHUB_USER
# Token used in local builds to access github packages
# or GITHUB_TOKEN in CI
ARG GITHUB_TOKEN
# Build stage
FROM maven:3.9.6-amazoncorretto-21-debian AS build
ARG GITHUB_USER
ENV GITHUB_USER=$GITHUB_USER
ARG GITHUB_TOKEN
ENV GITHUB_TOKEN=$GITHUB_TOKEN
# create a new working directory
WORKDIR /app
# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .
# installs the maven project from the base PSPWizard
RUN mvn -B install --settings settings.xml --file pom.xml -DskipTests=true -Dmaven.javadoc.skip=true -Dcheckstyle.skipExec=true -Dgithub.token=$GITHUB_TOKEN -Dgithub.name=$GITHUB_USER
# Package stage
FROM eclipse-temurin:21-jdk-alpine AS package
# gets the *.jar file from the api application from the build stage
COPY --from=build /app/target/*.jar app.jar
# exposes the port of the spring app e.g. 8080
EXPOSE 8080
# starts the application
ENTRYPOINT ["java","-jar","app.jar"]