Skip to content

Commit 54664e3

Browse files
Updated:Dockerfile
1 parent 4cf78aa commit 54664e3

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

Dockerfile.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
FROM openjdk:latest
2-
COPY . /src
3-
WORKDIR /src
1+
FROM openjdk:17-jdk-alpine
42

3+
WORKDIR /app
4+
5+
# Only copy the JAR if it exists
6+
COPY ./target/concore-0.0.1-SNAPSHOT.jar /app/concore.jar || true
7+
8+
# Ensure the JAR file is executable if present
9+
RUN [ -f /app/concore.jar ] && chmod +x /app/concore.jar || true
10+
11+
EXPOSE 3000
12+
13+
# Run Java app only if the JAR exists, otherwise do nothing
14+
CMD ["/bin/sh", "-c", "if [ -f /app/concore.jar ]; then java -jar /app/concore.jar; else echo 'No Java application found, exiting'; fi"]

0 commit comments

Comments
 (0)