forked from cloverdx/cloverdx-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.AI
More file actions
96 lines (81 loc) · 3.77 KB
/
Dockerfile.AI
File metadata and controls
96 lines (81 loc) · 3.77 KB
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
FROM nvidia/cuda:12.4.0-runtime-ubuntu22.04
ARG TOMCAT_URL="https://archive.apache.org/dist/tomcat/tomcat-10/v10.1.46/bin/apache-tomcat-10.1.46.tar.gz"
# Tomcat home directory
ENV CATALINA_HOME /opt/tomcat
# Directory with persistent data, visible to users (sandboxes, logs, configuration files)
ENV CLOVER_HOME_DIR /var/clover
# Directory with persistent data, invisible to users (tempspaces)
ENV CLOVER_DATA_DIR /var/cloverdata
# Shared libraries for both Tomcat and worker
ENV CLOVER_LIB_DIR /var/clover-lib
# Change location for DJL model and engine native files
ENV DJL_CACHE_DIR $CLOVER_DATA_DIR/djl.ai
# Correct path to CUDA libs (the base image sets the path to legacy nvidia-docker v1)
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64
# Default directories for configuration files
ENV CLOVER_CONF_DIR $CLOVER_HOME_DIR/conf
ENV CATALINA_CONF_DIR $CATALINA_HOME/conf
# Configuration files
ENV CLOVER_CONF_FILE $CLOVER_CONF_DIR/clover.properties
ENV JNDI_CONF_FILE $CLOVER_CONF_DIR/jndi-conf.xml
ENV JMX_CONF_FILE $CLOVER_CONF_DIR/jmx-conf.properties
ENV HTTPS_CONF_FILE $CLOVER_CONF_DIR/https-conf.xml
WORKDIR $CATALINA_HOME
# Change the default shell to Bash
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -eux && \
# The default answers be used for all questions
export DEBIAN_FRONTEND=noninteractive && \
# Change the default shell from dash to bash
ln -sfv /bin/bash /bin/sh && \
# Install required packages
apt-get update && \
apt-get install --no-install-recommends -y gosu tzdata fontconfig locales dumb-init curl && \
# Install Temurin JDK
curl -s https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor > /etc/apt/trusted.gpg.d/adoptium.gpg && \
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" > /etc/apt/sources.list.d/adoptium.list && \
apt-get update && \
apt-get install --no-install-recommends -y temurin-17-jdk && \
apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* && \
# Install en_US locale
locale-gen 'en_US.UTF-8' && \
# Verify that gosu works
gosu nobody true && \
# Download and extract Tomcat
curl "$TOMCAT_URL" | tar -xz --strip-components=1 && \
# Create directories
mkdir -p $CLOVER_CONF_DIR $CLOVER_HOME_DIR $CLOVER_DATA_DIR && \
# Change permissions for the writable directories - CLO-16457
chmod -R o+x $CATALINA_HOME/work $CATALINA_HOME/webapps $CATALINA_HOME/logs $CATALINA_HOME/temp && \
# Remove unused directories
rm -rf $CATALINA_HOME/webapps/* && \
# Remove websocket support
rm $CATALINA_HOME/lib/tomcat-websocket.jar && \
rm $CATALINA_HOME/lib/websocket-api.jar
# Set default locale to en_US; see also 'locale-gen' command above
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
# Customize downloaded Tomcat
COPY internal/tomcat public/tomcat internal/docker public/docker $CATALINA_HOME/
# Copy additional libraries
COPY public/var /var
# Copy clover.war
COPY clover.war $CATALINA_HOME/webapps
# Change permissions for startup scripts
RUN chmod u+x entrypoint.sh && \
chmod u+x bin/setenv.sh
# Create volumes for Clover home dir and internal data dir
VOLUME $CLOVER_HOME_DIR $CLOVER_DATA_DIR
# 8080: HTTP, 8686 and 8687: JMX for Core server, 8688 and 8689: JMX for worker
EXPOSE 8080 8686 8687 8688 8689
# Check if container is running correctly
HEALTHCHECK --start-period=120s --interval=30s --retries=4 --timeout=5s \
CMD bash -c '\
RESPONSE=$(curl -s -o /tmp/.healthcheck -w "%{http_code}" http://localhost:8080/clover/accessibilityTest.jsp); \
BODY=$(cat /tmp/.healthcheck); \
echo "HTTP status: $RESPONSE, body: $BODY"; \
if [ "$RESPONSE" -eq 200 ]; then exit 0; \
elif [ "$RESPONSE" -eq 503 ] && [ "$BODY" = "SUSPENDED" ]; then exit 0; \
else exit 1; fi'
ENTRYPOINT ["/usr/bin/dumb-init", "--", "./entrypoint.sh"]