-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile.profiler
117 lines (89 loc) · 3.26 KB
/
Dockerfile.profiler
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## Apache Jena Fuseki server Dockerfile.
## This Dockefile builds a reduced footprint container.
ARG OPENJDK_VERSION=17
ARG ALPINE_VERSION=3.15.0
ARG JENA_VERSION=4.7.0
# Internal, passed between stages.
ARG FUSEKI_DIR=/fuseki
ARG FUSEKI_JAR=jena-fuseki-server-${JENA_VERSION}.jar
ARG JAVA_MINIMAL=/opt/java-minimal
## ---- Stage: Download and build java.
FROM openjdk:${OPENJDK_VERSION}-alpine AS base
ARG JAVA_MINIMAL
ARG JENA_VERSION
ARG FUSEKI_DIR
ARG FUSEKI_JAR
ARG REPO=https://repo1.maven.org/maven2
ARG JAR_URL=${REPO}/org/apache/jena/jena-fuseki-server/${JENA_VERSION}/${FUSEKI_JAR}
RUN [ "${JENA_VERSION}" != "" ] || { echo -e '\n**** Set JENA_VERSION ****\n' ; exit 1 ; }
RUN echo && echo "==== Docker build for Apache Jena Fuseki ${JENA_VERSION} ====" && echo
# Alpine: For objcopy used in jlink
RUN apk add --no-cache curl binutils
## -- Fuseki installed and runs in /fuseki.
WORKDIR $FUSEKI_DIR
## -- Download the jar file.
COPY download.sh .
RUN chmod a+x download.sh
# Download, with check of the SHA1 checksum.
RUN ./download.sh --chksum sha1 "$JAR_URL"
## -- Alternatives to download : copy already downloaded.
## COPY ${FUSEKI_JAR} .
## Use Docker ADD - does not retry, does not check checksum, and may run every build.
## ADD "$JAR_URL"
## -- Make reduced Java JDK
ARG JDEPS_EXTRA="jdk.crypto.cryptoki,jdk.crypto.ec"
RUN \
JDEPS="$(jdeps --multi-release base --print-module-deps --ignore-missing-deps ${FUSEKI_JAR})" && \
jlink \
--compress 2 --strip-debug --no-header-files --no-man-pages \
--output "${JAVA_MINIMAL}" \
--add-modules "${JDEPS},${JDEPS_EXTRA}"
ADD entrypoint.sh .
ADD log4j2.properties .
# Run as this user
# -H : no home directorry
# -D : no password
RUN adduser -H -D fuseki fuseki
## ---- Stage: Build runtime
FROM openjdk:17-jdk-buster
## Import ARGs
ARG JENA_VERSION
ARG JAVA_MINIMAL
ARG FUSEKI_DIR
ARG FUSEKI_JAR
COPY --from=base /opt/java-minimal /opt/java-minimal
COPY --from=base /fuseki /fuseki
COPY --from=base /etc/passwd /etc/passwd
WORKDIR $FUSEKI_DIR
ARG LOGS=${FUSEKI_DIR}/logs
ARG DATA=${FUSEKI_DIR}/databases
RUN \
mkdir -p $LOGS && \
mkdir -p $DATA && \
chown -R fuseki ${FUSEKI_DIR} && \
chmod a+x entrypoint.sh
## Default environment variables.
ENV \
#JAVA_HOME=${JAVA_MINIMAL} \
JAVA_OPTIONS="-Xmx2048m -Xms2048m" \
JENA_VERSION=${JENA_VERSION} \
FUSEKI_JAR="${FUSEKI_JAR}" \
FUSEKI_DIR="${FUSEKI_DIR}"
USER fuseki
EXPOSE 3030
ENTRYPOINT ["./entrypoint.sh" ]
CMD []