forked from DevMadhup/Springboot-BankApp
-
Notifications
You must be signed in to change notification settings - Fork 196
/
Copy pathDockerfile
37 lines (26 loc) · 953 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
35
36
37
#----------------------------------
# Stage 1
#----------------------------------
# Import docker image with maven installed
FROM maven:3.8.3-openjdk-17 as builder
# Add maintainer, so that new user will understand who had written this Dockerfile
MAINTAINER Madhup Pandey<madhuppandey2908@gmail.com>
# Add labels to the image to filter out if we have multiple application running
LABEL app=bankapp
# Set working directory
WORKDIR /src
# Copy source code from local to container
COPY . /src
# Build application and skip test cases
RUN mvn clean install -DskipTests=true
#--------------------------------------
# Stage 2
#--------------------------------------
# Import small size java image
FROM openjdk:17-alpine as deployer
# Copy build from stage 1 (builder)
COPY --from=builder /src/target/*.jar /src/target/bankapp.jar
# Expose application port
EXPOSE 8080
# Start the application
ENTRYPOINT ["java", "-jar", "/src/target/bankapp.jar"]