-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (28 loc) · 1013 Bytes
/
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
# Use rust so that it will work with the later environments
FROM rust:1 as base
WORKDIR /crabtrap_test
ENV LD_LIBRARY_PATH=/usr/local/lib
COPY sample_program/printf_wrapper.c \
sample_program/dynamic.c \
sample_program/static.c \
sample_program/child.c \
./
RUN gcc -c -o libprintf_wrapper.o printf_wrapper.c \
&& ar rcs libprintf_wrapper.a libprintf_wrapper.o \
&& gcc -shared -fPIC -o /usr/local/lib/libprintf_wrapper.so printf_wrapper.c \
&& gcc -o dynamic dynamic.c -ldl \
&& gcc -o static static.c -lprintf_wrapper \
&& gcc -o child child.c \
&& gcc -static-pie -o all-in-one static.c -L. -l:libprintf_wrapper.a
FROM rust:1
ENV LD_LIBRARY_PATH=/usr/local/lib
COPY --from=base /usr/local/lib/libprintf_wrapper.so /usr/local/lib/
COPY --from=base /crabtrap_test/static \
/crabtrap_test/dynamic \
/crabtrap_test/all-in-one \
/crabtrap_test/child \
/usr/local/bin/
WORKDIR /crabtrap
COPY Cargo.toml Cargo.lock sample_program/config.yaml ./
COPY src src
COPY tests tests