-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
115 lines (102 loc) · 3.61 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
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
ARG XNAT_VERSION=1.9.1.1
ARG XNAT_ROOT=/data/xnat
ARG XNAT_HOME=/data/xnat/home
# default plugins for AIS
ARG container_service_ver=3.6.2-fat
ARG ldap_auth_ver=1.2.1
ARG ohif_viewer_ver=3.7.0-XNAT-1.8.10
ARG openid_auth_ver=1.3.1-xpl
ARG xsync_ver=1.8.1
ARG batch_launch_ver=0.7.0
ARG jupyterhub_ver=1.3.0
FROM tomcat:9-jdk8 AS build
ARG XNAT_VERSION
ARG XNAT_ROOT
ARG XNAT_HOME
# default plugins for AIS
ARG container_service_ver
ARG ldap_auth_ver
ARG ohif_viewer_ver
ARG openid_auth_ver
ARG xsync_ver
ARG batch_launch_ver
ARG jupyterhub_ver
RUN <<EOT
apt-get update
apt-get install -y \
unzip \
wget
rm -rf /var/lib/apt/lists/*
EOT
# Setup XNAT base directory structure
RUN <<EOT
mkdir -p \
${XNAT_ROOT}/archive \
${XNAT_ROOT}/build \
${XNAT_ROOT}/cache \
${XNAT_ROOT}/fileStore \
${XNAT_ROOT}/ftp \
${XNAT_HOME}/config/auth \
${XNAT_HOME}/logs \
${XNAT_HOME}/plugins \
${XNAT_HOME}/themes \
${XNAT_HOME}/work \
${XNAT_ROOT}/inbox \
${XNAT_ROOT}/pipeline \
${XNAT_ROOT}/prearchive
EOT
# Install XNAT web Java application
RUN <<EOT
rm -rf ${CATALINA_HOME}/webapps/*
mkdir -p ${CATALINA_HOME}/webapps/ROOT
wget --no-verbose -P /tmp \
https://api.bitbucket.org/2.0/repositories/xnatdev/xnat-web/downloads/xnat-web-${XNAT_VERSION}.war
unzip -o -d ${CATALINA_HOME}/webapps/ROOT /tmp/xnat-web-${XNAT_VERSION}.war
EOT
# Download standard plugins
RUN <<EOT
wget --no-verbose -P ${XNAT_HOME}/plugins \
https://api.bitbucket.org/2.0/repositories/xnatdev/container-service/downloads/container-service-${container_service_ver}.jar
wget --no-verbose -P ${XNAT_HOME}/plugins \
https://api.bitbucket.org/2.0/repositories/xnatx/ldap-auth-plugin/downloads/ldap-auth-plugin-${ldap_auth_ver}.jar
wget --no-verbose -P ${XNAT_HOME}/plugins \
https://api.bitbucket.org/2.0/repositories/icrimaginginformatics/ohif-viewer-xnat-plugin/downloads/ohif-viewer-${ohif_viewer_ver}.jar
wget --no-verbose -P ${XNAT_HOME}/plugins \
https://api.bitbucket.org/2.0/repositories/xnatx/openid-auth-plugin/downloads/openid-auth-plugin-${openid_auth_ver}.jar
wget --no-verbose -P ${XNAT_HOME}/plugins \
https://api.bitbucket.org/2.0/repositories/xnatdev/xsync/downloads/xsync-plugin-all-${xsync_ver}.jar
wget --no-verbose -P ${XNAT_HOME}/plugins \
https://api.bitbucket.org/2.0/repositories/xnatx/xnatx-batch-launch-plugin/downloads/batch-launch-${batch_launch_ver}.jar
wget --no-verbose -P ${XNAT_HOME}/plugins \
https://api.bitbucket.org/2.0/repositories/xnatx/xnat-jupyterhub-plugin/downloads/xnat-jupyterhub-plugin-${jupyterhub_ver}.jar
EOT
FROM tomcat:9-jdk8
ARG XNAT_VERSION
ARG XNAT_ROOT
ARG XNAT_HOME
RUN <<EOT
apt update
apt install -y \
less \
telnet \
vim
rm -rf /var/lib/apt/lists/*
rm -rf ${CATALINA_HOME}/webapps/*
EOT
COPY --from=build ${CATALINA_HOME}/webapps/ ${CATALINA_HOME}/webapps/
COPY --from=build ${XNAT_ROOT} ${XNAT_ROOT}
RUN <<EOT
sed -i \
's/ch.qos.logback.core.rolling.RollingFileAppender/ch.qos.logback.core.ConsoleAppender/' \
${CATALINA_HOME}/webapps/ROOT/WEB-INF/classes/logback.xml
EOT
COPY --chmod=0755 ./entrypoint.sh /usr/local/bin/entrypoint.sh
COPY ./xnat-conf.properties ${XNAT_HOME}/config/xnat-conf.properties
ENV XNAT_HOME=${XNAT_HOME} \
XNAT_VERSION=${XNAT_VERSION} \
TZ=UTC \
CATALINA_OPTS="-XX:InitialRAMPercentage=40.0 -XX:MaxRAMPercentage=50.0 -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow -Dxnat.home=${XNAT_HOME}"
LABEL org.opencontainers.image.source https://github.com/australian-imaging-service/xnat-docker-build
LABEL maintainer="AIS Team"
ENTRYPOINT ["entrypoint.sh"]
CMD ["catalina.sh","run"]