-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.compilers
75 lines (55 loc) · 1.49 KB
/
Dockerfile.compilers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM ubuntu:jammy-20240530 AS tool-installer
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
curl \
git \
make \
python3 \
python3-venv \
python3-pip \
uuid-dev \
wget \
unzip \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth=1 https://github.com/compiler-explorer/infra.git infra \
&& cd infra/ \
&& rm -rf .git \
&& python3 -m venv .venv \
&& . ./.venv/bin/activate \
&& make ce \
&& ./bin/ce_install list
COPY <<EOF /usr/bin/installer
#!/usr/bin/env bash
set -ex
set -o pipefail
ARGS=()
. /infra/.venv/bin/activate
mkdir /tmp/staging
mkdir /opt/libcxx-infra
if [[ "\$NIGHTLY" == "true" ]]; then
ARGS+=("--enable" "nightly")
elif [[ "\$NIGHTLY" == "false" ]]; then
echo "Not nightly"
else
echo "NIGHTLY must be either 'true' or 'false'"
exit 1
fi
if [[ -z "\$TOOL_ID" ]]; then
echo "TOOL_ID must be set"
exit 1
fi
/infra/bin/ce_install --staging-dir /tmp/staging --dest /opt/libcxx-infra "\${ARGS[@]}" install "\$TOOL_ID"
rm -rf /tmp/staging
EOF
RUN chmod +x /usr/bin/installer
FROM tool-installer AS install-tool
ARG TOOL_ID
ENV TOOL_ID=${TOOL_ID}
ARG NIGHTLY=false
ENV NIGHTLY=${NIGHTLY}
RUN /usr/bin/installer
# Use alpine as the base for the minimal final image. The image should only contain the tool, and will be copied into
# other images that will eventually use it.
FROM alpine AS installed-tool
COPY --from=install-tool /opt/libcxx-infra /opt/libcxx-infra