-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
81 lines (70 loc) · 2.25 KB
/
Dockerfile
File metadata and controls
81 lines (70 loc) · 2.25 KB
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
# syntax=docker/dockerfile:1.6
# This image has all the dependencies neccessary to build, test, and publish rust projects.
# "Wait," you ask. "What's going on here?" Rather than handling rustup validation
# and verification, we can list the rust container as a prior build stage, and
# then pull in the artifacts we need. There is an added benefit that tagged versions
# also include minor releases, so 1.2 includes 1.2.1 and so on, for bugfix releases.
FROM rust:1.83-slim-bookworm as RUSTBUILD
FROM debian:bookworm-slim
# Install rust and rust tooling
COPY --from=RUSTBUILD /usr/local/cargo /usr/local/cargo
COPY --from=RUSTBUILD /usr/local/rustup /usr/local/rustup
RUN apt-get update && apt-get install -y \
augeas-tools \
build-essential \
ca-certificates \
clang \
cmake \
curl \
default-jre \
gettext-base \
gh \
git \
jq \
libssl-dev \
nodejs \
npm \
openssl \
pkg-config \
libsqlite3-dev \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install protoc for the current platform
RUN <<EOF
#!/bin/sh
set -e
current_arch=$(dpkg --print-architecture)
if [ "$current_arch" = "amd64" ]
then
export PROTOC_ARCH="linux-x86_64"
elif [ "$current_arch" = "arm64" ]
then
export PROTOC_ARCH="linux-aarch_64"
else
echo "unknown architecture: $current_arch"
exit 1
fi
PROTOC_VERSION=3.20.1
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP \
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
&& rm -f $PROTOC_ZIP
exit 0
EOF
ENV PROTOC=/usr/local/bin/protoc
ENV PROTOC_INCLUDE=/usr/local/include
# Finsh rust setup
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN rustup component add rustfmt clippy
# Install useful tools for generating releases
RUN cargo install git-cliff cargo-release cargo-machete
ENV UNAME=root
USER root
ENV HOME=/$UNAME \
CARGO_HOME=/$UNAME/.cargo
# Setup npm env
ENV NPM_CONFIG_PREFIX=${HOME}/.npm-global/
ENV PATH=${NPM_CONFIG_PREFIX}/bin:${PATH}