-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 795 Bytes
/
Dockerfile
File metadata and controls
29 lines (21 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Get latest java
FROM eclipse-temurin:17-jdk-jammy AS build
# Set the working directory
WORKDIR /app
# Copy the build.gradle and settings.gradle files
COPY build.gradle .
COPY settings.gradle .
COPY gradlew .
COPY gradle ./gradle
# Copy the src directory
COPY src ./src
# Build the application without running the tests and with stacktrace
RUN ./gradlew clean build -x test --stacktrace
# Expose port 8080
EXPOSE 8080
# Run the application
ENTRYPOINT ["java","-jar","/app/build/libs/java-springdata-quickstart-0.0.1-SNAPSHOT.jar"]
# Build the image
# docker build -t java-springdata-quickstart .
# Run the container
# docker run -d --name springdata-container -p 9440:8080 java-springdata-quickstart -e DB_CONN_STR=<connection_string> -e DB_USERNAME=<username> -e DB_PASSWORD=<password>