Skip to content

Commit b865aca

Browse files
committed
Add Scala Native build dependencies to the Docker image
Reduces the size of the image by ~200MB by only installing required packages (via --no-install-recommends) and uses modern apt-key features to fetch the LLVM repo key.
1 parent 93cef0f commit b865aca

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,30 @@ ARG UBUNTU_VERSION=18.04
22
FROM ubuntu:$UBUNTU_VERSION
33

44
RUN set -x \
5+
&& : Remove pre-bundled libunwind \
6+
&& find /usr -name "*libunwind*" -delete \
57
&& apt update \
6-
&& apt install -y apt-transport-https gnupg2 ca-certificates \
8+
&& apt install -y --no-install-recommends apt-transport-https gnupg2 ca-certificates \
79
&& echo "deb https://dl.bintray.com/sbt/debian /" > /etc/apt/sources.list.d/sbt.list \
810
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 \
911
&& apt update \
10-
&& apt install -y curl build-essential openjdk-8-jdk-headless sbt cmake make clang-format-5.0 \
12+
&& apt install -y --no-install-recommends \
13+
g++ openjdk-8-jdk-headless sbt cmake make curl git \
14+
libgc-dev libunwind8-dev libre2-dev \
1115
&& rm -rf /var/lib/apt/lists/*
1216

1317
ARG LLVM_VERSION=6.0
1418
ENV LLVM_VERSION=$LLVM_VERSION
1519
# LLVM dev versions do not have a "-x.y" version suffix.
1620
ARG LLVM_DEB_COMPONENT=-$LLVM_VERSION
1721
RUN set -x \
18-
&& curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
1922
&& . /etc/lsb-release \
2023
&& echo "deb https://apt.llvm.org/$DISTRIB_CODENAME/ llvm-toolchain-$DISTRIB_CODENAME$LLVM_DEB_COMPONENT main" > /etc/apt/sources.list.d/llvm.list \
24+
&& apt-key adv --fetch-keys https://apt.llvm.org/llvm-snapshot.gpg.key \
2125
&& apt update \
22-
&& apt install -y clang-$LLVM_VERSION libclang-$LLVM_VERSION-dev \
26+
&& apt install -y --no-install-recommends \
27+
clang-$LLVM_VERSION clang-format-$LLVM_VERSION \
28+
libclang-$LLVM_VERSION-dev llvm-$LLVM_VERSION-dev \
2329
&& rm -rf /var/lib/apt/lists/*
2430

2531
WORKDIR /src

0 commit comments

Comments
 (0)