diff --git a/backend/Dockerfile b/backend/Dockerfile
index c82b821..4b7670b 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -1,9 +1,10 @@
-FROM python:3.8-slim-buster
+FROM python:3.8-slim-buster as base
 
 # system packages installation
 
 RUN apt update && apt install -y ffmpeg libimage-exiftool-perl curl nfs-common cifs-utils libopenblas-dev libmagickwand-dev libheif-dev libmagic1 ufraw-batch libboost-all-dev libxrender-dev liblapack-dev git bzip2 cmake build-essential libsm6 libglib2.0-0 libgl1-mesa-glx libpq-dev --no-install-recommends
 
+FROM base as model
 # pre trained models download
 WORKDIR /data_models
 RUN mkdir -p /root/.cache/torch/hub/checkpoints/
@@ -12,6 +13,7 @@ RUN curl -SL https://github.com/LibrePhotos/librephotos-docker/releases/download
 RUN curl -SL https://download.pytorch.org/models/resnet152-b121ed2d.pth -o /root/.cache/torch/hub/checkpoints/resnet152-b121ed2d.pth
 RUN pip install torch==1.8.0+cpu torchvision==0.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
 
+FROM base as dlib
 # Build and install dlib
 WORKDIR /
 RUN git clone https://github.com/davisking/dlib.git && \
@@ -23,6 +25,7 @@ RUN git clone https://github.com/davisking/dlib.git && \
     python setup.py install --no USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA --no USE_SSE4_INSTRUCTIONS  
 
 # actual project
+FROM base
 ARG DEBUG
 WORKDIR /code
 RUN git clone https://github.com/LibrePhotos/librephotos .
@@ -31,5 +34,8 @@ RUN if [ "$DEBUG" = 1 ] ; then pip install -r requirements.dev.txt ;  fi
 RUN python -m spacy download en_core_web_sm
 EXPOSE 8001
 
+COPY --from=model /data_models /data-models
+COPY --from=dlib /dlib/build /dlib/build
 COPY entrypoint.sh /entrypoint.sh
 CMD ["/entrypoint.sh"]
+