forked from jodconverter/docker-image-jodconverter-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (45 loc) · 2.41 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
# ---------------------------------- setup our needed libreoffice engaged server with newest glibc
# we cannot use the official image since we then cannot have sid and the glibc fix
# we could use jre, but would need to ensure we use a jdk variant in development. For OSS we make it easier here
FROM bellsoft/liberica-openjdk-debian:11 as jodconverter-base
RUN apt-get update && apt-get -y install \
apt-transport-https locales-all libpng16-16 libxinerama1 libgl1-mesa-glx libfontconfig1 libfreetype6 libxrender1 \
libxcb-shm0 libxcb-render0 adduser cpio findutils \
# procps needed for us finding the libreoffice process, see https://github.com/sbraconnier/jodconverter/issues/127#issuecomment-463668183
procps \
# only for stretch
#&& apt-get -y install -t stretch-backports libreoffice --no-install-recommends \
# sid variant
&& apt-get -y install libreoffice --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
ENV JAR_FILE_NAME=app.war
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 \
&& chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["--spring.config.additional-location=/etc/app/"]
# ---------------------------------- build our jodconvert builder, so source code with build tools
FROM openjdk:11-jdk as jodconverter-builder
RUN apt-get update \
&& apt-get -y install git \
&& git clone https://github.com/sbraconnier/jodconverter /tmp/jodconverter \
&& mkdir /dist
# ---------------------------------- gui builder
FROM jodconverter-builder as jodconverter-gui
WORKDIR /tmp/jodconverter/jodconverter-samples/jodconverter-sample-spring-boot
RUN ../../gradlew build \
&& cp build/libs/*SNAPSHOT.war /dist/jodconverter-gui.war
# ---------------------------------- rest build
FROM jodconverter-builder as jodconverter-rest
WORKDIR /tmp/jodconverter/jodconverter-samples/jodconverter-sample-rest
RUN ../../gradlew build \
&& cp build/libs/*SNAPSHOT.war /dist/jodconverter-rest.war
# ---------------------------------- GUI prod image
FROM jodconverter-base as gui
COPY --from=jodconverter-gui /dist/jodconverter-gui.war ${JAR_FILE_BASEDIR}/${JAR_FILE_NAME}
# ---------------------------------- REST prod image
FROM jodconverter-base as rest
COPY --from=jodconverter-rest /dist/jodconverter-rest.war ${JAR_FILE_BASEDIR}/${JAR_FILE_NAME}