Skip to content

Commit cd91a7d

Browse files
Rollup merge of rust-lang#41958 - malbarbo:docker-share, r=alexcrichton
ci: allows files to be shared by docker images Change `src/ci/docker/run.sh` to allow files to be shared when building docker containers. For while, only android related shell scripts are shared. Others containers can be updated at any time. sccache is installed last, as it is frequently updated this avoids the need to rebuilt the whole container.
2 parents 0ed1ec9 + 9b184c0 commit cd91a7d

File tree

34 files changed

+245
-262
lines changed

34 files changed

+245
-262
lines changed

src/ci/docker/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ for example:
1616

1717
Images will output artifacts in an `obj` dir at the root of a repository.
1818

19+
## Filesystem layout
20+
21+
- Each directory, excluding `scripts` and `disabled`, corresponds to a docker image
22+
- `scripts` contains files shared by docker images
23+
- `disabled` contains images that are not build travis
24+
1925
## Cross toolchains
2026

2127
A number of these images take quite a long time to compile as they're building

src/ci/docker/arm-android/Dockerfile

+33-37
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,44 @@ FROM ubuntu:16.04
22

33
RUN apt-get update && \
44
apt-get install -y --no-install-recommends \
5+
ca-certificates \
6+
cmake \
7+
curl \
8+
file \
59
g++ \
10+
git \
11+
libssl-dev \
612
make \
7-
file \
8-
curl \
9-
ca-certificates \
13+
pkg-config \
1014
python2.7 \
11-
git \
12-
cmake \
13-
unzip \
1415
sudo \
15-
xz-utils \
16-
libssl-dev \
17-
pkg-config
18-
19-
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20-
dpkg -i dumb-init_*.deb && \
21-
rm dumb-init_*.deb
16+
unzip \
17+
xz-utils
2218

23-
RUN curl -o /usr/local/bin/sccache \
24-
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
25-
chmod +x /usr/local/bin/sccache
19+
# dumb-init
20+
COPY scripts/dumb-init.sh /scripts/
21+
RUN sh /scripts/dumb-init.sh
2622

27-
# Install NDK
28-
COPY install-ndk.sh /tmp
29-
RUN . /tmp/install-ndk.sh && \
30-
download_ndk android-ndk-r13b-linux-x86_64.zip && \
31-
make_standalone_toolchain arm 9 && \
32-
remove_ndk
23+
# ndk
24+
COPY scripts/android-ndk.sh /scripts/
25+
RUN . /scripts/android-ndk.sh && \
26+
download_and_make_toolchain android-ndk-r13b-linux-x86_64.zip arm 9
3327

34-
# Install SDK
28+
# sdk
3529
RUN dpkg --add-architecture i386 && \
3630
apt-get update && \
3731
apt-get install -y --no-install-recommends \
38-
openjdk-9-jre-headless \
39-
tzdata \
40-
libstdc++6:i386 \
4132
libgl1-mesa-glx \
42-
libpulse0
33+
libpulse0 \
34+
libstdc++6:i386 \
35+
openjdk-9-jre-headless \
36+
tzdata
4337

44-
COPY install-sdk.sh /tmp
45-
RUN . /tmp/install-sdk.sh && \
46-
download_sdk tools_r25.2.5-linux.zip && \
47-
download_sysimage armeabi-v7a 18 && \
48-
create_avd armeabi-v7a 18
38+
COPY scripts/android-sdk.sh /scripts/
39+
RUN . /scripts/android-sdk.sh && \
40+
download_and_create_avd tools_r25.2.5-linux.zip armeabi-v7a 18
4941

50-
# Setup env
42+
# env
5143
ENV PATH=$PATH:/android/sdk/tools
5244
ENV PATH=$PATH:/android/sdk/platform-tools
5345

@@ -57,8 +49,12 @@ ENV RUST_CONFIGURE_ARGS \
5749
--target=$TARGETS \
5850
--arm-linux-androideabi-ndk=/android/ndk/arm-9
5951

60-
ENV SCRIPT python2.7 ../x.py test --target $TARGETS --verbose
52+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
53+
54+
# sccache
55+
COPY scripts/sccache.sh /scripts/
56+
RUN sh /scripts/sccache.sh
6157

62-
# Entrypoint
63-
COPY start-emulator.sh /android/
64-
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/android/start-emulator.sh"]
58+
# init
59+
COPY scripts/android-start-emulator.sh /scripts/
60+
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/scripts/android-start-emulator.sh"]

src/ci/docker/arm-android/install-ndk.sh

-35
This file was deleted.

src/ci/docker/armhf-gnu/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ WORKDIR /build
3131
# The `vexpress_config` config file was a previously generated config file for
3232
# the kernel. This file was generated by running `make vexpress_defconfig`
3333
# followed by `make menuconfig` and then enabling the IPv6 protocol page.
34-
COPY vexpress_config /build/.config
34+
COPY armhf-gnu/vexpress_config /build/.config
3535
RUN curl https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.42.tar.xz | \
3636
tar xJf - && \
3737
cd /build/linux-4.4.42 && \
@@ -63,11 +63,11 @@ RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-bas
6363

6464
# Copy over our init script, which starts up our test server and also a few
6565
# other misc tasks.
66-
COPY rcS rootfs/etc/init.d/rcS
66+
COPY armhf-gnu/rcS rootfs/etc/init.d/rcS
6767
RUN chmod +x rootfs/etc/init.d/rcS
6868

6969
# Helper to quickly fill the entropy pool in the kernel.
70-
COPY addentropy.c /tmp/
70+
COPY armhf-gnu/addentropy.c /tmp/
7171
RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
7272

7373
# TODO: What is this?!

src/ci/docker/cross/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ ENTRYPOINT ["/usr/bin/dumb-init", "--"]
3232

3333
WORKDIR /tmp
3434

35-
COPY build-rumprun.sh /tmp/
35+
COPY cross/build-rumprun.sh /tmp/
3636
RUN ./build-rumprun.sh
3737

38-
COPY build-arm-musl.sh /tmp/
38+
COPY cross/build-arm-musl.sh /tmp/
3939
RUN ./build-arm-musl.sh
4040

4141
# originally from

src/ci/docker/disabled/dist-aarch64-android/Dockerfile

+24-23
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,30 @@ FROM ubuntu:16.04
22

33
RUN apt-get update && \
44
apt-get install -y --no-install-recommends \
5+
ca-certificates \
6+
cmake \
7+
curl \
8+
file \
59
g++ \
10+
git \
11+
libssl-dev \
612
make \
7-
file \
8-
curl \
9-
ca-certificates \
13+
pkg-config \
1014
python2.7 \
11-
git \
12-
cmake \
13-
unzip \
1415
sudo \
15-
xz-utils \
16-
libssl-dev \
17-
pkg-config
18-
19-
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20-
dpkg -i dumb-init_*.deb && \
21-
rm dumb-init_*.deb
22-
23-
RUN curl -o /usr/local/bin/sccache \
24-
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
25-
chmod +x /usr/local/bin/sccache
16+
unzip \
17+
xz-utils
2618

27-
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
19+
# dumb-init
20+
COPY scripts/dumb-init.sh /scripts/
21+
RUN sh /scripts/dumb-init.sh
2822

29-
COPY android-ndk.sh /
30-
RUN . /android-ndk.sh && \
31-
download_ndk android-ndk-r13b-linux-x86_64.zip && \
32-
make_standalone_toolchain arm64 21 && \
33-
remove_ndk
23+
# ndk
24+
COPY scripts/android-ndk.sh /scripts/
25+
RUN . /scripts/android-ndk.sh && \
26+
download_and_make_toolchain android-ndk-r13b-linux-x86_64.zip arm64 21
3427

28+
# env
3529
ENV PATH=$PATH:/android/ndk/arm64-21/bin
3630

3731
ENV DEP_Z_ROOT=/android/ndk/arm64-21/sysroot/usr/
@@ -47,3 +41,10 @@ ENV RUST_CONFIGURE_ARGS \
4741
--enable-cargo-openssl-static
4842

4943
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS
44+
45+
# sccache
46+
COPY scripts/sccache.sh /scripts/
47+
RUN sh /scripts/sccache.sh
48+
49+
# init
50+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]

src/ci/docker/disabled/dist-armv7-android/Dockerfile

+26-23
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,36 @@ FROM ubuntu:16.04
22

33
RUN apt-get update && \
44
apt-get install -y --no-install-recommends \
5+
ca-certificates \
6+
cmake \
7+
curl \
8+
file \
59
g++ \
10+
git \
11+
libssl-dev \
612
make \
7-
file \
8-
curl \
9-
ca-certificates \
13+
pkg-config \
1014
python2.7 \
11-
git \
12-
cmake \
13-
unzip \
1415
sudo \
15-
xz-utils \
16-
libssl-dev \
17-
pkg-config
18-
19-
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20-
dpkg -i dumb-init_*.deb && \
21-
rm dumb-init_*.deb
22-
23-
RUN curl -o /usr/local/bin/sccache \
24-
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
25-
chmod +x /usr/local/bin/sccache
16+
unzip \
17+
xz-utils
2618

27-
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
19+
# dumb-init
20+
COPY scripts/dumb-init.sh /scripts/
21+
RUN sh /scripts/dumb-init.sh
2822

29-
COPY android-ndk.sh /
30-
RUN . /android-ndk.sh && \
23+
# ndk
24+
COPY scripts/android-ndk.sh /scripts/
25+
RUN . /scripts/android-ndk.sh && \
3126
download_ndk android-ndk-r13b-linux-x86_64.zip && \
3227
make_standalone_toolchain arm 9 && \
3328
make_standalone_toolchain arm 21 && \
3429
remove_ndk
3530

31+
RUN chmod 777 /android/ndk && \
32+
ln -s /android/ndk/arm-21 /android/ndk/arm
33+
34+
# env
3635
ENV PATH=$PATH:/android/ndk/arm-9/bin
3736

3837
ENV DEP_Z_ROOT=/android/ndk/arm-9/sysroot/usr/
@@ -54,12 +53,16 @@ ENV RUST_CONFIGURE_ARGS \
5453
# level 9), the default linker behavior is to generate an error, to allow the
5554
# build to finish we use --warn-unresolved-symbols. Note that the missing
5655
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
57-
RUN chmod 777 /android/ndk && \
58-
ln -s /android/ndk/arm-21 /android/ndk/arm
59-
6056
ENV SCRIPT \
6157
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
6258
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
6359
rm /android/ndk/arm && \
6460
ln -s /android/ndk/arm-9 /android/ndk/arm && \
6561
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
62+
63+
# sccache
64+
COPY scripts/sccache.sh /scripts/
65+
RUN sh /scripts/sccache.sh
66+
67+
# init
68+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]

src/ci/docker/disabled/dist-i686-android/Dockerfile

+26-23
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,36 @@ FROM ubuntu:16.04
22

33
RUN apt-get update && \
44
apt-get install -y --no-install-recommends \
5+
ca-certificates \
6+
cmake \
7+
curl \
8+
file \
59
g++ \
10+
git \
11+
libssl-dev \
612
make \
7-
file \
8-
curl \
9-
ca-certificates \
13+
pkg-config \
1014
python2.7 \
11-
git \
12-
cmake \
13-
unzip \
1415
sudo \
15-
xz-utils \
16-
libssl-dev \
17-
pkg-config
18-
19-
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20-
dpkg -i dumb-init_*.deb && \
21-
rm dumb-init_*.deb
22-
23-
RUN curl -o /usr/local/bin/sccache \
24-
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
25-
chmod +x /usr/local/bin/sccache
16+
unzip \
17+
xz-utils
2618

27-
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
19+
# dumb-init
20+
COPY scripts/dumb-init.sh /scripts/
21+
RUN sh /scripts/dumb-init.sh
2822

29-
COPY android-ndk.sh /
30-
RUN . /android-ndk.sh && \
23+
# ndk
24+
COPY scripts/android-ndk.sh /scripts/
25+
RUN . /scripts/android-ndk.sh && \
3126
download_ndk android-ndk-r13b-linux-x86_64.zip && \
3227
make_standalone_toolchain x86 9 && \
3328
make_standalone_toolchain x86 21 && \
3429
remove_ndk
3530

31+
RUN chmod 777 /android/ndk && \
32+
ln -s /android/ndk/x86-21 /android/ndk/x86
33+
34+
# env
3635
ENV PATH=$PATH:/android/ndk/x86-9/bin
3736

3837
ENV DEP_Z_ROOT=/android/ndk/x86-9/sysroot/usr/
@@ -54,12 +53,16 @@ ENV RUST_CONFIGURE_ARGS \
5453
# level 9), the default linker behavior is to generate an error, to allow the
5554
# build to finish we use --warn-unresolved-symbols. Note that the missing
5655
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
57-
RUN chmod 777 /android/ndk && \
58-
ln -s /android/ndk/x86-21 /android/ndk/x86
59-
6056
ENV SCRIPT \
6157
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
6258
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
6359
rm /android/ndk/x86 && \
6460
ln -s /android/ndk/x86-9 /android/ndk/x86 && \
6561
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
62+
63+
# sccache
64+
COPY scripts/sccache.sh /scripts/
65+
RUN sh /scripts/sccache.sh
66+
67+
# init
68+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]

0 commit comments

Comments
 (0)