forked from Doc-Cirrus/orthanc-mongodb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
205 lines (174 loc) · 6.59 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Orthanc Docker image based on CentOS Linux
#
# Building the image:
#
# $ docker build -t orthanc .
#
# Running the container:
#
# - The configuration file or directory should be mounted into the container
# and its path should to be specified as the last command line argument. If
# not specified, the default configuration is used. Default configuration
# file can be generated by 'Orthanc --config=orthanc.json'.
#
# The plugin requires mongodb running please run the mongodb on host or in docker container
#
# docker run --network host -d mongo
#
# Sample config files are in the config folder.
#
# Run Orthanc server in docer example:
#
# $ docker run \
# --network host \
# -v <config directory on host>:/etc/orthanc \
# -it --rm \
# orthanc \
# /etc/orthanc
#
# ------------------------------------------------------------------------------
# ==============================================================================
# Build stage
# ==============================================================================
FROM centos:7 AS build
ARG CMAKE_VERSION=3.13.2
# Default build type for each Orthanc component. Accepted values are "Release"
# and "Debug". It can be overridden for each component, individually.
ARG ORTHANC_BUILD_TYPE=Release
# Number of compilation jobs to run simultaneously
ARG JOBS=3
# ------------------------------------------------------------------------------
# Add locale support and set UTF-8 locale.
# ------------------------------------------------------------------------------
ENV LANG en_US.UTF-8
# ------------------------------------------------------------------------------
# Compile Orthanc Core
# ------------------------------------------------------------------------------
ARG ORTHANC_CORE_VERSION=1.5.0
ARG ORTHANC_CORE_BUILD_TYPE=${ORTHANC_BUILD_TYPE}
RUN yum -y install centos-release-scl \
&& yum -y install centos-release-scl-rh \
&& yum -y install devtoolset-7 \
&& yum -y install \
libuuid-devel \
openssl-devel \
cyrus-sasl-devel \
patch \
unzip \
python \
curl-devel \
dcmtk-devel \
gtest-devel \
jsoncpp-devel \
libjpeg-devel \
libpng-devel \
sqlite-devel \
lua-devel >= 5.1.0 \
mongoose-devel \
openssl-devel \
pugixml-devel
RUN curl -L --output cmake.tar.gz /~https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& tar xf cmake.tar.gz -C /usr --strip-components=1
RUN curl -L --output orthanc.tar.gz http://www.orthanc-server.com/downloads/get.php?path=/orthanc/Orthanc-${ORTHANC_CORE_VERSION}.tar.gz \
&& mkdir orthanc orthanc-build \
&& tar xf orthanc.tar.gz -C orthanc --strip-components=1 \
&& cd orthanc-build \
&& source /opt/rh/devtoolset-7/enable \
&& cmake \
-DCMAKE_BUILD_TYPE:STRING=${ORTHANC_CORE_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX:PATH=/install \
-DSTANDALONE_BUILD:BOOL=ON \
-DSTATIC_BUILD:BOOL=ON \
-DALLOW_DOWNLOADS:BOOL=ON \
-DUSE_SYSTEM_SQLITE:BOOL=OFF \
-DUSE_SYSTEM_BOOST:BOOL=OFF \
-DUSE_SYSTEM_CURL:BOOL=OFF \
-DSYSTEM_MONGOOSE_USE_CALLBACKS:BOOL=OFF \
-DUNIT_TESTS_WITH_HTTP_CONNEXIONS:BOOL=OFF \
../orthanc \
&& make -j ${JOBS} \
&& make install
# ------------------------------------------------------------------------------
# Compile MongoDB plugin
# ------------------------------------------------------------------------------
ARG ORTHANC_MONGODB_ENABLED=true
ARG ORTHANC_MONGODB_BUILD_TYPE=${ORTHANC_BUILD_TYPE}
ARG MONGO_C_DRIVER_VERSION=1.12.0
RUN if ${ORTHANC_MONGODB_ENABLED} ; then \
curl -L --output mongo-c-driver.tar.gz /~https://github.com/mongodb/mongo-c-driver/releases/download/${MONGO_C_DRIVER_VERSION}/mongo-c-driver-${MONGO_C_DRIVER_VERSION}.tar.gz \
&& mkdir mongo-c-driver mongo-c-driver-build \
&& tar xf mongo-c-driver.tar.gz -C mongo-c-driver --strip-components=1 \
&& cd mongo-c-driver-build \
&& source /opt/rh/devtoolset-7/enable \
&& cmake \
-DCMAKE_BUILD_TYPE=${ORTHANC_MONGODB_BUILD_TYPE} \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_INSTALL_PREFIX=/install \
../mongo-c-driver \
&& make -j ${JOBS} \
&& make install \
; fi
ARG MONGO_CXX_DRIVER_VERSION=3.3.1
RUN if ${ORTHANC_MONGODB_ENABLED} ; then \
yum -y install git \
&& curl -L --output mongo-cxx-driver.tar.gz /~https://github.com/mongodb/mongo-cxx-driver/archive/r${MONGO_CXX_DRIVER_VERSION}.tar.gz \
&& mkdir mongo-cxx-driver mongo-cxx-driver-build \
&& tar xf mongo-cxx-driver.tar.gz -C mongo-cxx-driver --strip-components=1 \
&& cd mongo-cxx-driver-build \
&& source /opt/rh/devtoolset-7/enable \
&& cmake \
-DCMAKE_BUILD_TYPE=${ORTHANC_MONGODB_BUILD_TYPE} \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_INSTALL_PREFIX=/install \
-DLIBBSON_DIR=/install \
-DLIBMONGOC_DIR=/install \
../mongo-cxx-driver \
&& make -j ${JOBS} \
&& make install \
; fi
ARG JSONCPP_VERSION=1.8.0
RUN if ${ORTHANC_MONGODB_ENABLED} ; then \
curl -L --output jsoncpp.tar.gz /~https://github.com/open-source-parsers/jsoncpp/archive/${JSONCPP_VERSION}.tar.gz \
&& mkdir jsoncpp jsoncpp-build \
&& tar xf jsoncpp.tar.gz -C jsoncpp --strip-components=1 \
&& cd jsoncpp-build \
&& source /opt/rh/devtoolset-7/enable \
&& cmake \
-DCMAKE_BUILD_TYPE:STRING=${ORTHANC_MONGODB_BUILD_TYPE} \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_INSTALL_PREFIX=/install \
../jsoncpp \
&& make -j ${JOBS} \
&& make install \
; fi
RUN mkdir orthanc-mongodb orthanc-mongodb-build
COPY ./ orthanc-mongodb/
RUN if ${ORTHANC_MONGODB_ENABLED} ; then \
cd orthanc-mongodb-build \
&& source /opt/rh/devtoolset-7/enable \
&& cmake \
-DBUILD_TESTS:BOOL=OFF \
-DCMAKE_BUILD_TYPE=${ORTHANC_MONGODB_BUILD_TYPE} \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_INSTALL_PREFIX=/install \
-DCMAKE_PREFIX_PATH="/install" \
-DORTHANC_ROOT:PATH=/orthanc \
../orthanc-mongodb \
&& make -j ${JOBS} \
# && ./IndexTest \
# && ./StorageTest \
&& install libOrthancMongoDB{Index,Storage}.so /install/share/orthanc/plugins/ \
&& strip /install/share/orthanc/plugins/* \
; fi
# ==============================================================================
# Install stage
# ==============================================================================
FROM centos:7
# ------------------------------------------------------------------------------
# Add locale support and set UTF-8 locale.
# ------------------------------------------------------------------------------
ENV LANG en_US.UTF-8
COPY --from=build /install/ /usr/
EXPOSE 4242
EXPOSE 8042
ENTRYPOINT [ "Orthanc" ]