Skip to content

Commit 9fc43cd

Browse files
janekbaraniewskipascalbreuninger
authored andcommitted
Refactor devcontainer dockerfile to support Kaniko builds
1 parent 6713269 commit 9fc43cd

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

.devcontainer/Dockerfile

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ ARG TARGETOS
44
ARG TARGETARCH
55

66
# Install Node.js
7-
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
7+
RUN apt-get update \
8+
&& apt-get install -y --no-install-recommends curl ca-certificates gnupg \
9+
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
810
&& apt-get update \
911
&& apt-get install -y --no-install-recommends nodejs \
1012
&& apt-get clean \
@@ -18,21 +20,24 @@ ENV RUSTUP_HOME=/usr/local/rustup \
1820

1921
# Install Rust
2022
RUN set -eux; \
21-
dpkgArch="$(dpkg --print-architecture)"; \
22-
case "${dpkgArch##*-}" in \
23-
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \
24-
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \
25-
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
26-
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \
27-
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
28-
esac; \
29-
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
30-
wget "$url"; \
31-
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
32-
chmod +x rustup-init; \
33-
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
34-
rm rustup-init; \
35-
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
23+
dpkgArch="$(dpkg --print-architecture)" || exit 1; \
24+
if [ "${dpkgArch}" = "amd64" ]; then \
25+
rustArch="x86_64-unknown-linux-gnu"; rustupSha256="0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db"; \
26+
elif [ "${dpkgArch}" = "armhf" ]; then \
27+
rustArch="armv7-unknown-linux-gnueabihf"; rustupSha256="f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a"; \
28+
elif [ "${dpkgArch}" = "arm64" ]; then \
29+
rustArch="aarch64-unknown-linux-gnu"; rustupSha256="673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800"; \
30+
elif [ "${dpkgArch}" = "i386" ]; then \
31+
rustArch="i686-unknown-linux-gnu"; rustupSha256="e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333"; \
32+
else \
33+
echo "unsupported architecture: ${dpkgArch}" >&2; exit 1; \
34+
fi; \
35+
wget "https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init" -O /tmp/rustup-init; \
36+
echo "${rustupSha256} */tmp/rustup-init" | sha256sum -c -; \
37+
chmod +x /tmp/rustup-init; \
38+
/tmp/rustup-init -y --no-modify-path --profile minimal --default-toolchain "$RUST_VERSION" --default-host "$rustArch"; \
39+
rm /tmp/rustup-init; \
40+
chmod -R a+w "$RUSTUP_HOME" "$CARGO_HOME"; \
3641
rustup --version; \
3742
cargo --version; \
3843
rustc --version

0 commit comments

Comments
 (0)