forked from firecracker-microvm/firecracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.x86_64
93 lines (86 loc) · 2.6 KB
/
Dockerfile.x86_64
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
FROM ubuntu:18.04
# TODO: use a multi-stage build to reduce the download size when updating this container.
# The Rust toolchain layer will get updated most frequently, but we could keep the system
# dependencies layer intact for much longer.
ARG RUST_TOOLCHAIN="1.43.1"
ARG TINI_VERSION_TAG="v0.18.0"
ARG TMP_BUILD_DIR=/tmp/build
ARG FIRECRACKER_SRC_DIR="/firecracker"
ARG FIRECRACKER_BUILD_DIR="$FIRECRACKER_SRC_DIR/build"
ARG CARGO_REGISTRY_DIR="$FIRECRACKER_BUILD_DIR/cargo_registry"
ARG CARGO_GIT_REGISTRY_DIR="$FIRECRACKER_BUILD_DIR/cargo_git_registry"
ENV CARGO_HOME=/usr/local/rust
ENV RUSTUP_HOME=/usr/local/rust
ENV PATH="$PATH:$CARGO_HOME/bin"
# Install system dependencies
#
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
binutils-dev \
cmake \
curl \
file \
g++ \
gcc \
gcc-aarch64-linux-gnu \
git \
iperf3 \
iproute2 \
jq \
libcurl4-openssl-dev \
libdw-dev \
libiberty-dev \
libssl-dev \
lsof \
make \
net-tools \
openssh-client \
pkgconf \
python \
python3 \
python3-dev \
python3-pip \
python3-venv \
zlib1g-dev \
screen \
&& python3 -m pip install \
setuptools \
wheel \
&& python3 -m pip install \
boto3 \
dataclasses \
nsenter \
psutil \
pycodestyle \
pydocstyle \
pylint \
pytest \
pytest-timeout \
pyyaml \
requests \
requests-unixsocket \
retry \
typing-extensions \
&& rm -rf /var/lib/apt/lists/*
# Install the Rust toolchain
#
RUN mkdir "$TMP_BUILD_DIR" \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \
&& rustup target add x86_64-unknown-linux-musl \
&& rustup component add rustfmt \
&& rustup component add clippy-preview \
&& cd "$TMP_BUILD_DIR" \
&& cargo install cargo-kcov \
&& cargo install cargo-audit \
&& cargo kcov --print-install-kcov-sh | sh \
&& rm -rf "$CARGO_HOME/registry" \
&& ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \
&& rm -rf "$CARGO_HOME/git" \
&& ln -s "$CARGO_GIT_REGISTRY_DIR" "$CARGO_HOME/git" \
&& cd / \
&& rm -rf "$TMP_BUILD_DIR"
# Add the tini init binary.
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION_TAG}/tini-static-amd64 /sbin/tini
RUN chmod +x /sbin/tini
WORKDIR "$FIRECRACKER_SRC_DIR"
ENTRYPOINT ["/sbin/tini", "--"]