-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
84 lines (72 loc) · 1.99 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
# Development Container
# Stage 1: Build yamlfmt
FROM golang:1 AS go-builder
# defined from build kit
# DOCKER_BUILDKIT=1 docker build . -t ...
ARG TARGETARCH
# Install yamlfmt
WORKDIR /yamlfmt
RUN go install github.com/google/yamlfmt/cmd/yamlfmt@latest && \
strip $(which yamlfmt) && \
yamlfmt --version
# Stage 2: Rust Development Container
FROM rust:1-slim
ARG TARGETARCH
# Install packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
binutils \
ca-certificates \
clang \
cmake \
curl \
git \
gnupg2 \
libssl-dev \
make \
ninja-build \
perl \
pkg-config \
protobuf-c-compiler \
python3 \
python3-pip \
ripgrep \
sudo \
valgrind \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN echo "building platform $(uname -m)"
# create dev user
RUN useradd --create-home --shell /bin/bash bonsol
RUN usermod -a -G sudo bonsol
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
## Rust
ENV USER=bonsol
COPY --chown=${USER}:${USER} --from=go-builder /go/bin/yamlfmt /go/bin/yamlfmt
USER bonsol
ENV PATH=${PATH}:/go/bin
# Set user and working directory
ARG PACKAGE=bonsol
USER bonsol
WORKDIR /workspaces/${PACKAGE}
# Install Rust components
RUN rustup component add \
rustfmt \
clippy \
rust-analyzer
RUN cargo install cargo-binstall
RUN yes | cargo binstall cargo-risczero
RUN cargo risczero build-toolchain
# Clean up
RUN rm -rf /home/bonsol/.cargo/registry /home/bonsol/.cargo/git
ENV PATH=${PATH}:/home/bonsol/.cargo/bin
LABEL \
org.label-schema.name="bonsol" \
org.label-schema.description="Bonsol Development Container" \
org.label-schema.url="https://github.com/anagrambuild/bonsol" \
org.label-schema.vcs-url="[email protected]/anagrambuild/bonsol.git" \
org.label-schema.vendor="anagram.xyz" \
org.label-schema.schema-version="1.0" \
org.opencontainers.image.description="Bonsol Development Container"