-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile
61 lines (46 loc) · 2.16 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
ARG RUNTIME_VERSION
# ------------------------- builder
FROM bellsoft/liberica-openjdk-debian:17 as builder
ARG VERSION=0.0.1-snapshot
RUN mkdir -p /src
COPY . /src
WORKDIR /src
RUN ./gradlew --no-daemon -Pversion=$VERSION clean build \
&& mkdir -p /dist && cp /src/build/libs/officeconverter-$VERSION.jar /dist/production.jar
# --------------------------- production image
ARG RUNTIME_VERSION
FROM ghcr.io/jodconverter/jodconverter-runtime:$RUNTIME_VERSION as production
######## COMMON BLOCK - PLEASE SYNC WITH DEV IMAGE ############
ENV JAR_FILE_NAME=officeconverter.jar
ENV JAR_FILE_BASEDIR=/opt/app
ENV LOG_BASE_DIR=/var/log
COPY ./bin/docker-entrypoint.sh /docker-entrypoint.sh
RUN mkdir -p ${JAR_FILE_BASEDIR} /etc/app \
&& touch /etc/app/application.properties /var/log/app.log /var/log/app.err \
&& chmod +x /docker-entrypoint.sh \
&& chown $NONPRIVUSER:$NONPRIVGROUP /var/log/app.log /var/log/app.err
COPY --from=builder /dist/production.jar ${JAR_FILE_BASEDIR}/${JAR_FILE_NAME}
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 8080
######## / COMMON BLOCK - PLEASE SYNC WITH DEV IMAGE / ############
CMD ["--spring.config.additional-location=optional:/etc/app/"]
# --------------------------- development image
ARG RUNTIME_VERSION
FROM ghcr.io/jodconverter/jodconverter-runtime:jdk-$RUNTIME_VERSION as development
######## COMMON BLOCK - PLEASE SYNC WITH PROD IMAGE ############
ENV JAR_FILE_NAME=officeconverter.jar
ENV JAR_FILE_BASEDIR=/opt/app
ENV LOG_BASE_DIR=/var/log
COPY ./bin/docker-entrypoint.sh /docker-entrypoint.sh
RUN mkdir -p ${JAR_FILE_BASEDIR} /etc/app \
&& touch /etc/app/application.properties /var/log/app.log /var/log/app.err \
&& chmod +x /docker-entrypoint.sh \
&& chown $NONPRIVUSER:$NONPRIVGROUP /var/log/app.log /var/log/app.err
COPY --from=builder /dist/production.jar ${JAR_FILE_BASEDIR}/${JAR_FILE_NAME}
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 8080
######## / COMMON BLOCK - PLEASE SYNC WITH PROD IMAGE / ############
EXPOSE 5001
CMD ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5001", "-jar","/opt/app/officeconverter.jar"]
# just a trick to ensure that he default docker image resulting is production
FROM production