Skip to content
Snippets Groups Projects
Unverified Commit a593f65d authored by Manuel's avatar Manuel Committed by GitHub
Browse files

Reduce number of stages

parent c1b08187
No related branches found
No related tags found
No related merge requests found
FROM ubuntu:hirsute FROM ubuntu:20.04
# system packages installation # system packages installation
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Install python RUN apt-get update && \
RUN apt-get update \ apt-get install -y --no-install-recommends \
&& apt-get install -y python3-pip python3-dev \ build-essential \
&& cd /usr/local/bin \ bzip2 \
&& ln -s /usr/bin/python3 python \ cifs-utils \
&& pip3 install --upgrade pip curl \
ffmpeg \
git \
libboost-all-dev \
libcfitsio-dev \
libexif-dev \
libexpat-dev \
libexpat1-dev \
libgif-dev \
libgl1-mesa-glx \
libglib2.0-dev \
libgsf-1-dev \
libheif-dev \
libimage-exiftool-perl \
libimagequant-dev \
libjpeg-dev \
liblapack-dev \
liblcms2-dev \
libmagic1 \
libopenblas-dev \
libopenexr-dev \
liborc-dev \
libpng-dev \
libpq-dev \
libraw-dev \
librsvg2-dev \
libsm6 \
libtiff5-dev \
libtool \
libtool-bin \
libwebp-dev \
libxrender-dev \
nfs-common \
pkg-config \
python3-dev \
python3-pip \
swig \
unzip \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install torch==1.9.1 torchvision==0.10.1 pyvips==2.1.15 cmake==3.21.2
RUN apt update && apt install -y ffmpeg swig cmake libimage-exiftool-perl curl nfs-common cifs-utils libopenblas-dev libheif-dev libmagic1 libraw-dev libboost-all-dev libxrender-dev liblapack-dev git bzip2 cmake build-essential libsm6 libglib2.0-dev libgl1-mesa-glx libpq-dev libexpat-dev \
librsvg2-dev \
libpng-dev \
libgif-dev \
libjpeg-dev \
libexif-dev \
liblcms2-dev \
liborc-dev \
pkg-config \
libexpat1-dev \
libtiff5-dev \
libgsf-1-dev \
libopenexr-dev \
libcfitsio-dev \
libimagequant-dev \
libtool \
libtool-bin \
wget \
libwebp-dev --no-install-recommends
#Build and install libraw #Build and install libraw
RUN git clone https://github.com/LibRaw/LibRaw WORKDIR /tmp/builds
RUN ls RUN git clone https://github.com/LibRaw/LibRaw && \
WORKDIR /LibRaw cd LibRaw && \
RUN autoreconf --install autoreconf --install && \
RUN ./configure ./configure && \
RUN make make && \
RUN make install make install
#Build and install imagemagick #Build and install imagemagick
WORKDIR / WORKDIR /tmp/builds
RUN mkdir /imagemagick ARG IMAGEMAGICK_VERSION=7.1.0-5
RUN curl -SL https://www.imagemagick.org/download/ImageMagick.tar.gz | tar -zxC /imagemagick RUN curl -SL https://www.imagemagick.org/download/releases/ImageMagick-${IMAGEMAGICK_VERSION}.tar.gz | tar -zx && \
WORKDIR /imagemagick/ImageMagick-7.1.0-5 cd ImageMagick-${IMAGEMAGICK_VERSION} && \
RUN ./configure --with-modules ./configure --with-modules && \
RUN make install make install && \
RUN ldconfig /usr/local/lib ldconfig /usr/local/lib
# Build and install libvips # Build and install libvips
WORKDIR /tmp/builds
ARG VIPSVERSION=8.11.0 ARG VIPSVERSION=8.11.0
ARG VIPSURL=https://github.com/libvips/libvips/releases/download RUN wget https://github.com/libvips/libvips/releases/download/v${VIPSVERSION}/vips-${VIPSVERSION}.tar.gz \
WORKDIR /usr/local/src
RUN wget ${VIPSURL}/v${VIPSVERSION}/vips-${VIPSVERSION}.tar.gz \
&& tar xzf vips-${VIPSVERSION}.tar.gz \ && tar xzf vips-${VIPSVERSION}.tar.gz \
&& cd vips-${VIPSVERSION} \ && cd vips-${VIPSVERSION} \
&& ./configure \ && ./configure \
...@@ -60,37 +82,34 @@ RUN wget ${VIPSURL}/v${VIPSVERSION}/vips-${VIPSVERSION}.tar.gz \ ...@@ -60,37 +82,34 @@ RUN wget ${VIPSURL}/v${VIPSVERSION}/vips-${VIPSVERSION}.tar.gz \
&& make install \ && make install \
&& ldconfig && ldconfig
# pre trained models download
WORKDIR /data_models
RUN mkdir -p /root/.cache/torch/hub/checkpoints/
RUN curl -SL https://github.com/LibrePhotos/librephotos-docker/releases/download/0.1/places365.tar.gz | tar -zxC /data_models/
RUN curl -SL https://github.com/LibrePhotos/librephotos-docker/releases/download/0.1/im2txt.tar.gz | tar -zxC /data_models/
RUN curl -SL https://github.com/LibrePhotos/librephotos-docker/releases/download/0.1/clip-embeddings.tar.gz | tar -zxC /data_models/
RUN curl -SL https://download.pytorch.org/models/resnet152-b121ed2d.pth -o /root/.cache/torch/hub/checkpoints/resnet152-b121ed2d.pth
RUN pip install torch torchvision
RUN pip3 install pyvips
# Build and install dlib # Build and install dlib
WORKDIR / WORKDIR /tmp/builds
RUN git clone https://github.com/davisking/dlib.git && \ RUN git clone --depth 1 --branch 'v19.22' https://github.com/davisking/dlib.git && \
mkdir /dlib/build && \ mkdir dlib/build && \
cd /dlib/build && \ cd dlib/build && \
cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=0 -DLIB_NO_GUI_SUPPORT=0 && \ cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=0 -DLIB_NO_GUI_SUPPORT=0 && \
cmake --build . && \ cmake --build . && \
cd /dlib && \ cd /tmp/builds/dlib && \
python setup.py install --no USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA --no USE_SSE4_INSTRUCTIONS python3 setup.py install --no USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA --no USE_SSE4_INSTRUCTIONS
#Build and install faiss. Needs to be build for ARM #Build and install faiss. Needs to be build for ARM
WORKDIR /faiss WORKDIR /tmp/builds
RUN git clone https://github.com/facebookresearch/faiss.git /faiss RUN git clone --depth 1 --branch 'v1.7.1' https://github.com/facebookresearch/faiss.git && \
RUN cmake -B build . -DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=ON -DFAISS_OPT_LEVEL=generic cd faiss && \
RUN make -C build -j4 faiss cmake -B build . -DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=ON -DFAISS_OPT_LEVEL=generic && \
RUN make -C build -j4 swigfaiss make -C build -j4 faiss && \
RUN (cd build/faiss/python && python setup.py install) make -C build -j4 swigfaiss && \
# install unzip cd build/faiss/python && \
RUN apt install -y unzip python3 setup.py install && \
# unzip faiss to actually installed it... unzip /usr/local/lib/python3.8/dist-packages/faiss*.egg -d /usr/local/lib/python3.8/dist-packages/
RUN unzip /usr/local/lib/python3.9/dist-packages/faiss*.egg -d /usr/local/lib/python3.9/dist-packages/
# pre trained models download
WORKDIR /data_models
RUN mkdir -p /root/.cache/torch/hub/checkpoints/ && \
curl -SL https://github.com/LibrePhotos/librephotos-docker/releases/download/0.1/places365.tar.gz | tar -zxC /data_models/ && \
curl -SL https://github.com/LibrePhotos/librephotos-docker/releases/download/0.1/im2txt.tar.gz | tar -zxC /data_models/ && \
curl -SL https://github.com/LibrePhotos/librephotos-docker/releases/download/0.1/clip-embeddings.tar.gz | tar -zxC /data_models/ && \
curl -SL https://download.pytorch.org/models/resnet152-b121ed2d.pth -o /root/.cache/torch/hub/checkpoints/resnet152-b121ed2d.pth
RUN rm -fr /tmp/*
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment