Skip to content

Commit

Permalink
Merge branch 'buildkit-cache' into dev-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ba committed Apr 30, 2024
2 parents 73484d3 + 32f5930 commit 874c2b3
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 148 deletions.
18 changes: 7 additions & 11 deletions docker-compose/database/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@

FROM mysql/mysql-server:5.7

COPY /shanoir-entrypoint.sh /
COPY --chmod=0755 /shanoir-entrypoint.sh /
ENTRYPOINT ["/shanoir-entrypoint.sh"]
CMD ["mysqld"]

ADD 1_create_databases.sh /docker-entrypoint-initdb.d/
ADD 2_add_users.sql /docker-entrypoint-initdb.d/
ADD 3_add_statistics_procedure.sql /docker-entrypoint-initdb.d/
ADD 4_add_studyStatistics_procedure.sql /docker-entrypoint-initdb.d/
COPY --chmod=0755 \
1_create_databases.sh \
2_add_users.sql \
3_add_statistics_procedure.sql \
4_add_studyStatistics_procedure.sql \
/docker-entrypoint-initdb.d/

RUN chmod a+x /docker-entrypoint-initdb.d/1_create_databases.sh
RUN chmod a+x /docker-entrypoint-initdb.d/2_add_users.sql
RUN chmod a+x /docker-entrypoint-initdb.d/3_add_statistics_procedure.sql
RUN chmod a+x /docker-entrypoint-initdb.d/4_add_studyStatistics_procedure.sql
RUN chmod a+x /shanoir-entrypoint.sh

COPY db-changes /opt/db-changes
40 changes: 26 additions & 14 deletions docker-compose/datasets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,48 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see https://www.gnu.org/licenses/gpl-3.0.html

FROM alpine as downloader

# Installation of dcm4che into /opt/dcm4che to manage the store-scu into the
# PACS dcm4che3, used last version 5.21.0 as available on the 2020-02-14
# https://sourceforge.net/projects/dcm4che/files/dcm4che3/
RUN wget -qO dcm4che-bin.zip \
https://downloads.sourceforge.net/project/dcm4che/dcm4che3/5.21.0/dcm4che-5.21.0-bin.zip \
&& mkdir -p /target/opt && cd /target/opt \
&& unzip /dcm4che-bin.zip && mv dcm4che-* dcm4che \
&& rm /dcm4che-bin.zip


#--------------- common jre base image -------------------------------------
FROM debian:bookworm
# NOTE: using bookworm-proposed-updates because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
# - disable the automatic "apt-get clean" command (because we mount
# /var/cache/apt from an external volume to speed-up the build)
# - NOTE: using bookworm-proposed-updates because of
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
rm /etc/apt/apt.conf.d/docker-clean \
&& echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
&& apt-get update -qq \
&& apt-get install -qqy openjdk-17-jre-headless ca-certificates-java
#----------------------------------------------------------------------------


RUN apt-get update -qq \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
apt-get update -qq \
&& apt-get install -qqy \
unzip \
pigz \
gzip \
locales \
locales-all \
wget

# Installation of dcm4che to manage the store-scu into the PACS
# dcm4che3, used last version 5.21.0 as available on the 2020-02-14
# https://sourceforge.net/projects/dcm4che/files/dcm4che3/
RUN wget -O dcm4che-5.21.0-bin.zip https://downloads.sourceforge.net/project/dcm4che/dcm4che3/5.21.0/dcm4che-5.21.0-bin.zip
RUN unzip dcm4che-5.21.0-bin.zip
locales-all

# take care of path
ENV PATH /dcm4che-5.21.0/bin:$PATH
ENV PATH /opt/dcm4che/bin:$PATH
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# install the files from the 'dowloader' stage
COPY --link --from=downloader /target/. /

RUN mkdir -pv /var/log/shanoir-ng-logs
ADD shanoir-ng-datasets.jar shanoir-ng-datasets.jar
COPY entrypoint entrypoint_common oneshot /bin/
Expand Down
35 changes: 7 additions & 28 deletions docker-compose/import/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,17 @@

#--------------- common jre base image -------------------------------------
FROM debian:bookworm
# NOTE: using bookworm-proposed-updates because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
# - disable the automatic "apt-get clean" command (because we mount
# /var/cache/apt from an external volume to speed-up the build)
# - NOTE: using bookworm-proposed-updates because of
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
rm /etc/apt/apt.conf.d/docker-clean \
&& echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
&& apt-get update -qq \
&& apt-get install -qqy openjdk-17-jre-headless ca-certificates-java
#----------------------------------------------------------------------------


#32 bits packages are necessary
RUN dpkg --add-architecture i386

RUN apt-get update -qq \
&& apt-get install -qqy \
git \
curl \
build-essential \
cmake \
pkg-config \
libgdcm-tools \
libarchive-tools \
unzip \
pigz \
gzip \
wget \
jq \
lib32z1 \
libgtk2.0-0 \
libsm6 \
libxext6 \
lib32stdc++6 \
libtiff6 \
libglib2.0-0:i386

RUN mkdir -pv /var/log/shanoir-ng-logs

ADD shanoir-ng-import.jar shanoir-ng-import.jar
Expand Down
4 changes: 1 addition & 3 deletions docker-compose/keycloak-database/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@

FROM mysql/mysql-server:5.7

ADD 1_add_users.sql /docker-entrypoint-initdb.d/

RUN chmod a+x /docker-entrypoint-initdb.d/1_add_users.sql
COPY --chmod=0755 1_add_users.sql /docker-entrypoint-initdb.d/
163 changes: 81 additions & 82 deletions docker-compose/nifti-conversion/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,108 +10,107 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see https://www.gnu.org/licenses/gpl-3.0.html

FROM debian:bookworm
FROM debian:bookworm as base_image

# NOTE: using bookworm-proposed-updates because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
&& apt-get update -qq \
&& apt-get install -qqy openjdk-17-jdk ca-certificates-java

#32 bits packages are necessary
RUN dpkg --add-architecture i386
RUN apt-get update

RUN apt-get update -qq \
&& apt-get install -y \
git \
curl \
cmake \
build-essential \
pkg-config \
libgdcm-tools \
libarchive-tools \
unzip \
pigz \
gzip \
gnupg \
wget \
jq \
lib32z1 \
libgtk2.0-0 \
libsm6 \
libxext6 \
lib32stdc++6 \
libtiff6 \
libglib2.0-0:i386 \
locales \
locales-all \
xvfb \
python3.11 \
python3-werkzeug \
python3-yaml \
software-properties-common
# - disable the automatic "apt-get clean" command (because we mount
# /var/cache/apt from an external volume to speed-up the build)
# - run "apt-get update" now (to avoid downloading the lists 3 times)
RUN rm /etc/apt/apt.conf.d/docker-clean \
&& apt-get update -qq

ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
FROM base_image as conda

#Install miniconda \
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-py311_24.1.2-0-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-py311_24.1.2-0-Linux-x86_64.sh -b \
&& rm -f Miniconda3-py311_24.1.2-0-Linux-x86_64.sh
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-conda \
apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install curl ca-certificates

# Install miniconda
RUN --mount=type=cache,target=/opt/miniconda3/pkgs \
curl -LSsf -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_24.1.2-0-Linux-x86_64.sh \
&& bash miniconda.sh -fb -p /opt/miniconda3 \
&& rm miniconda.sh

# Compile DCM2NIIX from source
ENV DCMCOMMIT_VERSION=v1.0.20210317
ENV DCMCOMMIT=1.0.20210317
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR.UTF-8
# Install dicomifier
RUN --mount=type=cache,target=/opt/miniconda3/pkgs \
/opt/miniconda3/bin/conda install -c conda-forge dicomifier -y

WORKDIR /usr/local/
RUN curl -#L https://github.com/rordenlab/dcm2niix/archive/refs/tags/$DCMCOMMIT_VERSION.zip | bsdtar -xf- -C .
WORKDIR /usr/local/dcm2niix-${DCMCOMMIT}
RUN mkdir build
WORKDIR /usr/local/dcm2niix-${DCMCOMMIT}/build
RUN cmake ..
RUN make install

WORKDIR /
FROM base_image as builder

RUN mkdir -p /opt/nifti-converters
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-builder \
apt-get -qqy update \
&& apt-get -qqy install \
build-essential \
curl \
cmake \
git \
pkg-config

# Copy converters files
RUN mkdir external
COPY external ./external
RUN install -m 0755 external/dcm2nii/linux/31MARCH2008/dcm2nii /opt/nifti-converters/dcm2nii_2008-03-31
RUN install -m 0755 external/dcm2nii/linux/dcm2nii /opt/nifti-converters/dcm2nii_2014-08-04
# Compile DCM2NIIX from source
ENV DCM2NIIX_VERSION=v1.0.20210317
RUN mkdir /src && cd /src \
&& curl -LSsf https://github.com/rordenlab/dcm2niix/archive/refs/tags/$DCM2NIIX_VERSION.tar.gz \
| tar zx \
&& cd dcm2niix-* && mkdir build \
&& cd build && cmake .. && make -j4 && make install DESTDIR=/target

RUN install -m 0755 external/mcverter/linux/mcverter_* /opt/nifti-converters/
RUN cp -n external/mcverter/linux/lib/lib*.so.* /usr/lib/x86_64-linux-gnu/
# Install mri_conv
RUN mkdir -p /target/opt/nifti-converters/mriconverter \
&& cd /target/opt/nifti-converters/mriconverter \
&& curl -LSsf https://github.com/populse/mri_conv/archive/refs/heads/master.tar.gz \
| tar zx --strip-components 1 \
&& chmod 0777 . MRIFileManager/MRIManager.jar

WORKDIR /opt/nifti-converters
RUN mkdir mriconverter
RUN curl -#L https://github.com/populse/mri_conv/archive/refs/heads/master.zip | bsdtar -xf- -C mriconverter --strip-components 1

RUN chmod 777 /opt/nifti-converters/mriconverter
RUN chmod 777 /opt/nifti-converters/mriconverter/MRIFileManager/MRIManager.jar
FROM base_image as final

WORKDIR /
# NOTE: using bookworm-proposed-updates because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
&& apt-get update -qq \
&& apt-get install -qqy openjdk-17-jre ca-certificates-java

RUN mkdir -m 1777 /.dcm2nii_2008-03-31
RUN mkdir -m 1777 /.dcm2nii_2014-08-04
# xvfb+gtk2 needed by mri_conv (headless mode not supported by DicomToNifti)
# see: https://populse.github.io/mri_conv/Installation/installation.html#scriptwithoutGUI
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
apt-get update -qqy \
&& apt-get install -qqy \
libgdcm-tools \
locales \
locales-all \
jq \
libgtk2.0-0 \
pigz \
xvfb

# Install dicomifier
RUN git -C /opt/nifti-converters clone https://github.com/lamyj/dicomifier.git
RUN conda install -c conda-forge dicomifier -y
# Copy converters files
COPY --chmod=0755 external/dcm2nii/linux/31MARCH2008/dcm2nii /opt/nifti-converters/dcm2nii_2008-03-31
COPY --chmod=0755 external/dcm2nii/linux/dcm2nii /opt/nifti-converters/dcm2nii_2014-08-04
COPY --chmod=0755 external/mcverter/linux/mcverter_* /opt/nifti-converters/
COPY external/mcverter/linux/lib/lib*.so.* /usr/local/lib/x86_64-linux-gnu/
RUN mkdir -m 1777 \
/.dcm2nii_2008-03-31 \
/.dcm2nii_2014-08-04

# install animaConvertImage to convert Analyze format into nifti
RUN install -m 755 external/anima/animaConvertImage /usr/local/bin/
COPY --chmod=0755 external/anima/animaConvertImage /usr/local/bin/

RUN mkdir -pv /var/log/shanoir-ng-logs
# install the binaries built in the 'builder' & 'conda' stages
COPY --link --from=builder /target/. /
COPY --link --from=conda /opt/miniconda3 /opt/miniconda3

# update the ld cache (so that the new libraries can be loaded)
# and make the log dir
RUN ldconfig \
&& mkdir -pv /var/log/shanoir-ng-logs

# install the microservice
ADD nifti-conversion.jar nifti-conversion.jar
COPY entrypoint entrypoint_common oneshot /bin/

ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR.UTF-8
ENV PATH="/opt/miniconda3/bin:${PATH}"

ENTRYPOINT ["/bin/entrypoint", "java", "-Djava.security.egd=file:/dev/./urandom", "-Djavax.net.ssl.trustStorePassword=changeit", "-jar", "/nifti-conversion.jar"]
9 changes: 7 additions & 2 deletions docker-compose/preclinical/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#--------------- common jre base image -------------------------------------
FROM debian:bookworm
# NOTE: using bookworm-proposed-updates because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
# - disable the automatic "apt-get clean" command (because we mount
# /var/cache/apt from an external volume to speed-up the build)
# - NOTE: using bookworm-proposed-updates because of
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
rm /etc/apt/apt.conf.d/docker-clean \
&& echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
&& apt-get update -qq \
&& apt-get install -qqy openjdk-17-jre-headless ca-certificates-java
#----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docker-compose/solr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
FROM solr:8.1

USER root
RUN mkdir -p /etc/shanoir-core-template
RUN chown solr:solr /etc/shanoir-core-template
RUN mkdir -p /etc/shanoir-core-template \
&& chown solr:solr /etc/shanoir-core-template
USER solr

COPY ./core /etc/shanoir-core-template
Expand Down
9 changes: 7 additions & 2 deletions docker-compose/studies/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@

#--------------- common jre base image -------------------------------------
FROM debian:bookworm
# NOTE: using bookworm-proposed-updates because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
# - disable the automatic "apt-get clean" command (because we mount
# /var/cache/apt from an external volume to speed-up the build)
# - NOTE: using bookworm-proposed-updates because of
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039472
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
rm /etc/apt/apt.conf.d/docker-clean \
&& echo "deb http://deb.debian.org/debian bookworm-proposed-updates main" >> /etc/apt/sources.list \
&& apt-get update -qq \
&& apt-get install -qqy openjdk-17-jre-headless ca-certificates-java
#----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 874c2b3

Please sign in to comment.