Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .Dockerfile.swp
Binary file not shown.
45 changes: 9 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
#----------------------------------
# Stage 1
#----------------------------------
FROM maven:3.9.6-eclipse-temurin-17-alpine AS builder #new base image added
workdir /app
copy . .
run mvn clean install -DskipTests=true
from openjdk:17-slim
workdir /app
COPY --from=builder /app/target/*.jar /app/app.jar
expose 8080
cmd ["java","-jar","/app/app.jar"]

# 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"]