mirror of
https://github.com/google/nsjail.git
synced 2026-08-30 18:41:30 -07:00
Modernize Dockerfile
Updates Dockerfile to use a more recent base image. Uses a slim Debian image and uses build stages. This results in 80% size reduction of the final image while still having a somewhat reasonable environment.
This commit is contained in:
committed by
happyCoder92
parent
583bc3eb24
commit
bc30a1a335
23
Dockerfile
23
Dockerfile
@@ -1,6 +1,16 @@
|
|||||||
FROM ubuntu:18.04
|
FROM debian:bookworm-slim AS base
|
||||||
|
|
||||||
|
# Install run-time dependencies in base image
|
||||||
RUN apt-get -y update && apt-get install -y \
|
RUN apt-get -y update && apt-get install -y \
|
||||||
|
libc6 \
|
||||||
|
libstdc++6 \
|
||||||
|
libprotobuf32 \
|
||||||
|
libnl-route-3-200
|
||||||
|
|
||||||
|
FROM base AS build
|
||||||
|
|
||||||
|
# Install build dependencies only in builder image
|
||||||
|
RUN apt-get install -y \
|
||||||
autoconf \
|
autoconf \
|
||||||
bison \
|
bison \
|
||||||
flex \
|
flex \
|
||||||
@@ -12,9 +22,14 @@ RUN apt-get -y update && apt-get install -y \
|
|||||||
libtool \
|
libtool \
|
||||||
make \
|
make \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
protobuf-compiler \
|
protobuf-compiler
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY . /nsjail
|
COPY . /nsjail
|
||||||
|
|
||||||
RUN cd /nsjail && make && mv /nsjail/nsjail /bin && rm -rf -- /nsjail
|
RUN cd /nsjail && make clean && make
|
||||||
|
|
||||||
|
FROM base AS run
|
||||||
|
|
||||||
|
# Copy over build result and trim image
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY --from=build /nsjail/nsjail /bin
|
||||||
|
|||||||
Reference in New Issue
Block a user