Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
Updated comments.
  • Loading branch information
nhkhai committed May 1, 2024
1 parent dc70629 commit 283c410
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# The base image.
# FROM eclipse-temurin:21-jdk-jammy as builder
FROM eclipse-temurin:21-jdk-alpine

# The work directory.
Expand All @@ -8,14 +9,17 @@ WORKDIR /
ENV PORT=9090
EXPOSE $PORT

# Copy the source code into the Docker image.
# Docker uses caching to speed up builds by reusing layers from previous builds.
# To take advantage of caching, you should order your Dockerfile instructions so that the ones that change frequently are placed towards the end of the file.
# For example, if you’re copying files into the image, you should do that at the end of the Dockerfile.
# The JAR file path.
# ARG JAR_FILE=*.jar
# ARG JAR_FILE=the-review-room-0.0.1-SNAPSHOT.jar

# Copy the JAR file from the build context into the Docker image.
# COPY target/${JAR_FILE} application.jar

# Copy the source code into the Docker image.
COPY .mvn/ .mvn
COPY mvnw pom.xml ./

Expand All @@ -24,11 +28,19 @@ COPY src ./src
# Modify the permissions of the mvnw script.
RUN chmod +x ./mvnw

# CMD apk update \
# && rm -rf /var/cache/apk/*
# RUN apk add --no-cache \
# package1 \
# package2 \
# package3 && \
# rm -rf /var/cache/apk/* /tmp/*

# RUN apt-get update && \
# rm -rf /var/lib/apt/lists/*

# RUN apt-get update && \
# apt-get install -y postgresql postgresql-contrib && \
# rm -rf /var/lib/apt/lists/*

# Set the default command to run the Java application.
#ENTRYPOINT ["java", "-Xmx2048M", "-jar", "/application.jar"]
# ENTRYPOINT ["java","-jar","/application.jar"]
# Compile the Java application.
RUN ./mvnw install -DskipTests
CMD ["./mvnw", "spring-boot:run"]

0 comments on commit 283c410

Please sign in to comment.