-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (23 loc) · 735 Bytes
/
Dockerfile
File metadata and controls
30 lines (23 loc) · 735 Bytes
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
# First stage (build)
FROM openjdk:18.0-jdk-slim-buster AS BUILD_IMAGE
# Creating package where will be our application
ENV APP_HOME=/root/dev/myapp/
WORKDIR $APP_HOME
# Copying gradle configs to package
COPY build.gradle gradlew gradlew.bat $APP_HOME
COPY gradle $APP_HOME/gradle
# download dependencies
RUN chmod +x gradlew
RUN ./gradlew build -x :bootJar -x test --continue
# copying dependecies
COPY . .
RUN chmod +x gradlew
RUN ./gradlew build -x test
# Second stage (run)
# Using jdk (necessary to run the build jar)
FROM openjdk:18.0-jdk-slim-buster AS RUN_IMAGE
WORKDIR /root/
#Copying our jar from the first stage
COPY --from=BUILD_IMAGE /root/dev/myapp/build/libs/*.jar .
EXPOSE 8080
CMD ["java","-jar","starwars.jar"]