Skip to content

Commit cb0e3bf

Browse files
committed
rm build artifacts and get dockerfile production ready
1 parent c7e1561 commit cb0e3bf

File tree

11 files changed

+88
-22
lines changed

11 files changed

+88
-22
lines changed

samples/javalin/app/.dockerignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Compiled class files
2+
*.class
3+
4+
# Log files
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.ear
17+
18+
# IntelliJ IDEA files
19+
.idea/
20+
*.iml
21+
22+
# VS Code files
23+
.vscode/
24+
25+
# macOS Finder metadata
26+
.DS_Store
27+
28+
# Maven target directory
29+
target/
30+
31+
# Database files
32+
*.db
33+
*.sqlite
34+
*.sqlite3

samples/javalin/app/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Compiled class files
2+
*.class
3+
4+
# Log files
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.ear
17+
18+
# IntelliJ IDEA files
19+
.idea/
20+
*.iml
21+
22+
# VS Code files
23+
.vscode/
24+
25+
# macOS Finder metadata
26+
.DS_Store
27+
28+
# Maven target directory
29+
target/
30+
31+
# Database files
32+
*.db
33+
*.sqlite
34+
*.sqlite3

samples/javalin/app/Dockerfile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
# Use a base image with OpenJDK
1+
# Stage 1: Build the application
2+
FROM maven:3.8.4-openjdk-17-slim AS build
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy the pom.xml and download dependencies
8+
COPY pom.xml .
9+
RUN mvn dependency:go-offline
10+
11+
# Copy the source code and build the application
12+
COPY src ./src
13+
RUN mvn clean package
14+
15+
# Stage 2: Create the runtime image
216
FROM openjdk:17-jdk-slim
317

418
# Set the working directory
519
WORKDIR /app
620

7-
# Copy the compiled Java classes and resources to the container
8-
COPY target/defang-javalin-1.0-SNAPSHOT.jar /app/app.jar
21+
# Copy the built jar file from the build stage
22+
COPY --from=build /app/target/defang-javalin-1.0.0.jar /app/app.jar
923

1024
# Expose the port Javalin will run on
1125
EXPOSE 7000
1226

1327
# Command to run the Javalin application
14-
CMD ["java", "-jar", "/app/app.jar"]
28+
CMD ["java", "-jar", "/app/app.jar"]

samples/javalin/app/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://www.maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.defang</groupId>
6+
<groupId>io.defang</groupId>
77
<artifactId>defang-javalin</artifactId>
8-
<version>1.0-SNAPSHOT</version>
8+
<version>1.0.0</version>
99

1010
<dependencies>
1111
<dependency>
-2.14 KB
Binary file not shown.
-5.11 MB
Binary file not shown.

samples/javalin/app/target/maven-archiver/pom.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.

samples/javalin/app/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

Lines changed: 0 additions & 1 deletion
This file was deleted.

samples/javalin/app/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

Lines changed: 0 additions & 1 deletion
This file was deleted.
-4.83 KB
Binary file not shown.

0 commit comments

Comments
 (0)