-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjava.Dockerfile
29 lines (17 loc) · 937 Bytes
/
java.Dockerfile
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
FROM maven:3.8.6-openjdk-8-slim as builder
WORKDIR /app
COPY pom.xml ./
RUN ["/usr/local/bin/mvn-entrypoint.sh", "mvn", "verify", "clean", "--fail-never"]
COPY . ./
ARG DB_URL
ARG DB_USERNAME
ARG DB_PASSWORD
RUN sed -i "s,name=\"hibernate\.connection\.url\" value=\".*\",name=\"hibernate\.connection\.url\" value=\"${DB_URL}\",g" "src/main/resources/META-INF/persistence.xml" \
&& sed -i "s,name=\"hibernate\.connection\.username\" value=\".*\",name=\"hibernate\.connection\.username\" value=\"${DB_USERNAME}\",g" "src/main/resources/META-INF/persistence.xml" \
&& sed -i "s,name=\"hibernate\.connection\.password\" value=\".*\",name=\"hibernate\.connection\.password\" value=\"${DB_PASSWORD}\",g" "src/main/resources/META-INF/persistence.xml"
RUN mvn package
FROM openjdk:8-jre-alpine as java
WORKDIR /app/target
COPY --from=builder /app/target ./
COPY public ./public
ENTRYPOINT ["java", "-jar", "application.jar"]