Skip to content

Commit 5b30d67

Browse files
committed
Adding v0.15.0 firecracker docker image
1 parent 9edbabe commit 5b30d67

File tree

3 files changed

+85
-3
lines changed

3 files changed

+85
-3
lines changed

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@ all-tests:
2727
generate build clean:
2828
go $@ $(EXTRAGOARGS)
2929

30-
.PHONY: all generate clean build test unit-tests all-tests
30+
sandbox-test-fc:
31+
docker build -f fctesting/sandbox/fc-latest -t "firecracker" .
32+
docker run \
33+
--init \
34+
--rm \
35+
--privileged \
36+
--security-opt seccomp=unconfined \
37+
--ulimit core=0 \
38+
--device=/dev/kvm:/dev/kvm \
39+
-t firecracker
40+
41+
.PHONY: all generate clean build test unit-tests all-tests sandbox-test

fctesting/sandbox/fc-latest

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
FROM ubuntu:18.04
2+
FROM golang:1.11
3+
4+
ADD . /firecracker-go-sdk/
5+
6+
ARG TMP_BUILD_DIR=/tmp/build
7+
ARG FIRECRACKER_SRC_DIR="/firecracker"
8+
ARG FIRECRACKER_BUILD_DIR="$FIRECRACKER_SRC_DIR/build"
9+
ARG CARGO_REGISTRY_DIR="$FIRECRACKER_BUILD_DIR/cargo_registry"
10+
ARG FIRECRACKER_GO_SDK_SRC_DIR="/firecracker-go-sdk"
11+
ARG FIRECRACKER_VERSION="0.15.0"
12+
13+
ENV CARGO_HOME=/usr/local/rust
14+
ENV RUSTUP_HOME=/usr/local/rust
15+
ENV PATH="$CARGO_HOME/bin:$PATH"
16+
ENV CARGO_TARGET_DIR="$FIRECRACKER_BUILD_DIR/cargo_target"
17+
ENV FC_TEST_DATA_PATH="$TMP_BUILD_DIR"
18+
19+
# Install system dependecies
20+
#
21+
RUN apt-get update \
22+
&& apt-get -y install --no-install-recommends \
23+
binutils-dev \
24+
cmake \
25+
curl \
26+
file \
27+
g++ \
28+
gcc \
29+
git \
30+
iperf3 \
31+
iproute2 \
32+
jq \
33+
libcurl4-openssl-dev \
34+
libdw-dev \
35+
libiberty-dev \
36+
libssl-dev \
37+
lsof \
38+
make \
39+
musl-tools \
40+
net-tools \
41+
openssh-client \
42+
pkgconf \
43+
zlib1g-dev \
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
# Install the Rust toolchain
47+
#
48+
# Install 1.32.0 due to Firecracker crashing with 148 code
49+
RUN mkdir "$TMP_BUILD_DIR" \
50+
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
51+
&& rustup install 1.32.0 \
52+
&& rustup override set 1.32.0 \
53+
&& rustup target add x86_64-unknown-linux-musl \
54+
&& cd /
55+
56+
# Install Firecracker and set binaries to TMP_BUILD_DIR
57+
RUN git clone https://github.com/firecracker-microvm/firecracker.git
58+
WORKDIR firecracker
59+
RUN git checkout tags/v"$FIRECRACKER_VERSION"
60+
RUN cargo build --release --features vsock --target-dir "$TMP_BUILD_DIR"
61+
RUN cp "$TMP_BUILD_DIR"/x86_64-unknown-linux-musl/release/firecracker "$TMP_BUILD_DIR"
62+
RUN cp "$TMP_BUILD_DIR"/x86_64-unknown-linux-musl/release/jailer "$TMP_BUILD_DIR"
63+
64+
WORKDIR "$FIRECRACKER_GO_SDK_SRC_DIR"
65+
RUN cp -rf testdata/* "$TMP_BUILD_DIR"
66+
RUN curl -fsSL -o "$TMP_BUILD_DIR"/vmlinux https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin
67+
RUN go mod download
68+
CMD ["make", "test"]

machine_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func TestMicroVMExecution(t *testing.T) {
341341
}
342342

343343
func TestStartVMM(t *testing.T) {
344-
socketPath := filepath.Join("testdata", "TestStartVMM.sock")
344+
socketPath := filepath.Join(testDataPath, "TestStartVMM.sock")
345345
defer os.Remove(socketPath)
346346
cfg := Config{
347347
SocketPath: socketPath,
@@ -376,12 +376,13 @@ func TestStartVMM(t *testing.T) {
376376
}
377377

378378
func TestStartVMMOnce(t *testing.T) {
379-
socketPath := filepath.Join("testdata", "TestStartVMMOnce.sock")
379+
socketPath := filepath.Join(testDataPath, "TestStartVMMOnce.sock")
380380
defer os.Remove(socketPath)
381381

382382
cfg := Config{
383383
SocketPath: socketPath,
384384
DisableValidation: true,
385+
LogLevel: "Debug",
385386
KernelImagePath: getVmlinuxPath(t),
386387
MachineCfg: models.MachineConfiguration{
387388
VcpuCount: 1,
@@ -391,6 +392,8 @@ func TestStartVMMOnce(t *testing.T) {
391392
cmd := VMCommandBuilder{}.
392393
WithSocketPath(cfg.SocketPath).
393394
WithBin(getFirecrackerBinaryPath()).
395+
WithStdout(os.Stdout).
396+
WithStderr(os.Stderr).
394397
Build(ctx)
395398
m, err := NewMachine(ctx, cfg, WithProcessRunner(cmd))
396399
if err != nil {

0 commit comments

Comments
 (0)