Skip to content

Commit

Permalink
fix(docker): don't share apt cache between arch build
Browse files Browse the repository at this point in the history
  • Loading branch information
sileht committed Oct 9, 2020
1 parent eec14ef commit 75dc9e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docker/cpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG DEEPDETECT_DEFAULT_MODELS=true
# Install build dependencies
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_cpu,target=/var/cache/apt --mount=type=cache,id=apt_lib_cpu,target=/var/lib/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && apt-get install -y python-dev apt-transport-https ca-certificates gnupg software-properties-common wget curl

Expand All @@ -20,7 +20,7 @@ RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
# bug closed as won't fix as python2 is eol: https://github.com/docker/for-linux/issues/502
RUN cp /bin/true /usr/bin/pycompile

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_cpu,target=/var/cache/apt --mount=type=cache,id=apt_lib_cpu,target=/var/lib/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && apt-get install -y \
git \
Expand Down Expand Up @@ -119,7 +119,7 @@ LABEL description="DeepDetect deep learning server & API / ${DEEPDETECT_ARCH} ve
LABEL maintainer="[email protected]"

# Install tools and dependencies
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_cpu,target=/var/cache/apt --mount=type=cache,id=apt_lib_cpu,target=/var/lib/apt \
apt-get update -y && apt-get install -y \
wget \
curl \
Expand Down
6 changes: 3 additions & 3 deletions docker/gpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG DEEPDETECT_DEFAULT_MODELS=true
# Install build dependencies
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_gpu,target=/var/cache/apt --mount=type=cache,id=apt_lib_gpu,target=/var/lib/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && apt-get install -y python-dev apt-transport-https ca-certificates gnupg software-properties-common wget curl

Expand All @@ -20,7 +20,7 @@ RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
# bug closed as won't fix as python2 is eol: https://github.com/docker/for-linux/issues/502
RUN cp /bin/true /usr/bin/pycompile

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_gpu,target=/var/cache/apt --mount=type=cache,id=apt_lib_gpu,target=/var/lib/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && apt-get install -y \
git \
Expand Down Expand Up @@ -119,7 +119,7 @@ LABEL description="DeepDetect deep learning server & API / ${DEEPDETECT_ARCH} ve
LABEL maintainer="[email protected]"

# Install tools and dependencies
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_gpu,target=/var/cache/apt --mount=type=cache,id=apt_lib_gpu,target=/var/lib/apt \
apt-get update -y && apt-get install -y \
wget \
curl \
Expand Down
6 changes: 3 additions & 3 deletions docker/gpu_tensorrt.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG DEEPDETECT_DEFAULT_MODELS=true
# Install build dependencies
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_gpu_tensorrt,target=/var/cache/apt --mount=type=cache,id=apt_lib_gpu_tensorrt,target=/var/lib/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && apt-get install -y python-dev apt-transport-https ca-certificates gnupg software-properties-common wget curl

Expand All @@ -20,7 +20,7 @@ RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
# bug closed as won't fix as python2 is eol: https://github.com/docker/for-linux/issues/502
RUN cp /bin/true /usr/bin/pycompile

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_gpu_tensorrt,target=/var/cache/apt --mount=type=cache,id=apt_lib_gpu_tensorrt,target=/var/lib/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && apt-get install -y \
git \
Expand Down Expand Up @@ -119,7 +119,7 @@ LABEL description="DeepDetect deep learning server & API / ${DEEPDETECT_ARCH} ve
LABEL maintainer="[email protected]"

# Install tools and dependencies
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
RUN --mount=type=cache,id=apt_cache_gpu_tensorrt,target=/var/cache/apt --mount=type=cache,id=apt_lib_gpu_tensorrt,target=/var/lib/apt \
apt-get update -y && apt-get install -y \
wget \
curl \
Expand Down
1 change: 1 addition & 0 deletions docker/sync_gpu_dockerfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ for dest in "${!images[@]}" ; do
sed \
-e "s,FROM [^ ]*,FROM ${image},g" \
-e "s,ARG DEEPDETECT_ARCH=.*,ARG DEEPDETECT_ARCH=gpu,g" \
-e "s/\(apt_\(cache\|lib\)\)_cpu/\1_${dest}/g" \
cpu.Dockerfile > ${dest}.Dockerfile
done

0 comments on commit 75dc9e9

Please sign in to comment.