Coding Global Background
Coding Global

Spring Boot - Docker Issue - Unable to access jarfile

Archived 2 years ago
0 messages
1 members
Created 2 years ago
Updated 2 years ago
Open in Discord
D
direct_x_34
Script Kiddie!
Hi, I have a problem to detect jar file when I run docker-compose.yml file.
Here is the repo : https://github.com/Rapter1990/simplebanking
How can I fix it.
Here is the Dockerfile shown below
# Stage 1: Build stage
FROM gradle:7.3-jdk11 AS build

# Set working directory
WORKDIR /simplebanking

# Copy Gradle files for dependency resolution
COPY build.gradle settings.gradle ./
COPY gradle gradle

# Copy application source code
COPY src src

# Build the project and create the executable JAR
RUN gradle clean build

# Stage 2: Run stage
FROM adoptopenjdk:11-jre-hotspot

# Set working directory
WORKDIR /simplebanking

# Copy the JAR file from the build stage
COPY --from=build /simplebanking/build/libs/*.jar simplebanking.jar

# Expose port 1222
EXPOSE 1222

# Set the entrypoint command for running the application
ENTRYPOINT ["java", "-jar", "simplebanking.jar"]

Spring Boot - Docker Issue - Unable to access jarfile