-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
193 lines (174 loc) · 7.22 KB
/
Dockerfile
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
FROM ghcr.io/tweedegolf/debian:bookworm
ARG TARGETARCH
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
unzip \
xz-utils \
zlib1g-dev \
libclang1 \
clang \
gdb \
lldb \
lld \
llvm \
cmake \
valgrind \
pkg-config \
libssl-dev \
libpq-dev \
libsqlite3-dev \
binaryen \
crossbuild-essential-amd64 \
crossbuild-essential-arm64 \
; \
rm -rf /var/lib/apt/lists/*;
ARG RUSTUP_VERSION
ENV RUSTUP_VERSION ${RUSTUP_VERSION}
ARG RUSTUP_SHA256_AMD64
ARG RUSTUP_SHA256_ARM64
ARG RUST_VERSION
ENV RUST_VERSION ${RUST_VERSION:-stable}
ARG RUST_COMPONENTS="rustfmt clippy rust-analysis rls rust-src"
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch="x86_64-unknown-linux-gnu"; rustupSha256=${RUSTUP_SHA256_AMD64} ;; \
arm64) rustArch="aarch64-unknown-linux-gnu"; rustupSha256=${RUSTUP_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O /usr/local/bin/rustup-init "https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${rustArch}/rustup-init"; \
if [ ! -z "${rustupSha256}" ]; then \
echo "${rustupSha256} */usr/local/bin/rustup-init" | sha256sum -c -; \
else \
echo "Checksum for rustup-init not verified"; \
fi; \
chmod +x /usr/local/bin/rustup-init; \
rustup-init -y --no-modify-path --default-toolchain "${RUST_VERSION}"; \
rustup target add wasm32-unknown-unknown; \
rustup target add aarch64-unknown-linux-gnu; \
rustup target add x86_64-unknown-linux-gnu; \
chmod -R a+rw ${RUSTUP_HOME} ${CARGO_HOME}; \
rm /usr/local/bin/rustup-init; \
rustup --version; \
cargo --version; \
rustc --version;
ARG SCCACHE_VERSION
ENV SCCACHE_VERSION ${SCCACHE_VERSION}
ARG SCCACHE_SHA256_AMD64
ARG SCCACHE_SHA256_ARM64
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) sccacheArch="x86_64-unknown-linux-musl"; sccacheSha256=${SCCACHE_SHA256_AMD64} ;; \
arm64) sccacheArch="aarch64-unknown-linux-musl"; sccacheSha256=${SCCACHE_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz" \
"https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz"; \
if [ ! -z "${sccacheSha256}" ]; then \
echo "${sccacheSha256} */tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz" | sha256sum -c -; \
else \
echo "Checksum for sccache not verified"; \
fi; \
cd /tmp; \
tar xvf "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz"; \
mv "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}/sccache" /usr/local/bin/sccache; \
chmod a+x /usr/local/bin/sccache; \
rm -rf "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}/"; \
rm -rf "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz"; \
sccache --version;
ARG CARGO_BINSTALL_VERSION
ENV CARGO_BINSTALL_VERSION ${CARGO_BINSTALL_VERSION}
ARG CARGO_BINSTALL_SHA256_AMD64
ARG CARGO_BINSTALL_SHA256_ARM64
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) cargo_binstall_arch="x86_64-unknown-linux-musl"; cargo_binstall_sha256=${CARGO_BINSTALL_SHA256_AMD64} ;; \
arm64) cargo_binstall_arch="aarch64-unknown-linux-musl"; cargo_binstall_sha256=${CARGO_BINSTALL_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O "/tmp/cargo-binstall-$cargo_binstall_arch.tgz" \
"https://github.com/cargo-bins/cargo-binstall/releases/download/v${CARGO_BINSTALL_VERSION}/cargo-binstall-$cargo_binstall_arch.tgz"; \
if [ ! -z "${cargo_binstall_sha256}" ]; then \
echo "${cargo_binstall_sha256} */tmp/cargo-binstall-${cargo_binstall_arch}.tgz" | sha256sum -c -; \
else \
echo "Checksum for cargo-binstall not verified"; \
fi; \
cd /tmp; \
tar xvf "/tmp/cargo-binstall-$cargo_binstall_arch.tgz"; \
mv /tmp/cargo-binstall /usr/local/bin/cargo-binstall; \
chmod a+x /usr/local/bin/cargo-binstall; \
rm -rf "/tmp/cargo-binstall-$cargo_binstall_arch.tgz"; \
cargo binstall -V;
COPY diesel.$TARGETARCH /usr/local/cargo/bin/diesel
COPY cargo-llvm-lines.$TARGETARCH /usr/local/cargo/bin/cargo-llvm-lines
RUN set -eux; \
chmod +x /usr/local/cargo/bin/diesel; \
chmod +x /usr/local/cargo/bin/cargo-llvm-lines; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) set -- --targets x86_64-unknown-linux-gnu --targets x86_64-unknown-linux-musl ;; \
arm64) set -- --targets aarch64-unknown-linux-gnu --targets aarch64-unknown-linux-musl ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
cargo binstall "$@" --no-confirm \
cargo-quickinstall \
cargo-audit \
cargo-outdated \
cargo-bloat \
cargo-llvm-cov \
cargo-watch \
cargo-edit \
cargo-chef \
cargo-sweep \
cargo-deny \
trunk \
mdbook \
wasm-bindgen-cli \
sqlx-cli \
; \
sqlx --version; \
wasm-bindgen --version; \
mdbook --version; \
trunk --version; \
cargo deny --version; \
cargo sweep --version; \
cargo chef --version; \
cargo upgrade --version; \
cargo llvm-cov --version; \
cargo bloat --version; \
cargo outdated --version; \
cargo audit --version; \
diesel --version; \
cargo llvm-lines --version;
ARG CARGO_UDEPS_VERSION
ENV CARGO_UDEPS_VERSION ${CARGO_UDEPS_VERSION}
ARG CARGO_UDEPS_SHA256_AMD64
ARG CARGO_UDEPS_SHA256_ARM64
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) udepsArch="x86_64-unknown-linux-musl"; udepsSha256=${CARGO_UDEPS_SHA256_AMD64} ;; \
arm64) udepsArch="aarch64-unknown-linux-musl"; udepsSha256=${CARGO_UDEPS_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz" \
"https://github.com/est31/cargo-udeps/releases/download/v${CARGO_UDEPS_VERSION}/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz"; \
if [ ! -z "${udepsSha256}" ]; then \
echo "${udepsSha256} */tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz" | sha256sum -c -; \
else \
echo "Checksum for cargo-udeps not verified"; \
fi; \
cd /tmp; \
tar xvf "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz"; \
mv "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}/cargo-udeps" /usr/local/cargo/bin/cargo-udeps; \
chmod a+x /usr/local/cargo/bin/cargo-udeps; \
rm -rf "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}/"; \
rm -rf "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz"; \
cargo udeps --version;