-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
45 lines (35 loc) · 1.02 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
# Part 1: a builder image with the dependencies to actually build the
# project. Gigabytes on disk.
FROM rust:slim-bookworm AS builder
WORKDIR /
RUN apt update
RUN apt-get install -y \
# ayb requirements
libssl-dev \
# nsjail requirements
autoconf \
bison \
flex \
gcc \
g++ \
git \
libprotobuf-dev \
libnl-route-3-dev \
libtool \
make \
pkg-config \
protobuf-compiler
RUN git clone https://github.com/google/nsjail.git nsjail-checkout && cd nsjail-checkout && make && mv nsjail .. && cd .. && rm -rf nsjail-checkout
COPY . /ayb
RUN cd ayb && cargo build --release
# Part 2: the image with the binaries built by the builder and no
# unnecessary dependencies or build artifacts. Low hundreds of
# megabytes on disk.
FROM debian:bookworm-slim
RUN apt update
RUN apt-get install -y libssl-dev
COPY --from=builder /ayb/target/release/ayb /bin
COPY --from=builder /ayb/target/release/ayb_isolated_runner /bin
COPY --from=builder /nsjail /bin
EXPOSE 5433
CMD ["/bin/ayb", "server"]