forked from trajano/alpine-libfaketime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (28 loc) · 883 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
33
34
35
36
FROM alpine:3.18
RUN apk add build-base git
RUN git clone https://github.com/wolfcw/libfaketime /usr/local/src/libfaketime
WORKDIR /usr/local/src/libfaketime
RUN make && make install
# Library is in
# - /usr/local/lib/faketime/libfaketimeMT.so.1
# - /usr/local/lib/faketime/libfaketime.so.1
# Build the image just to store the file
FROM scratch
COPY --from=0 /usr/local/lib/faketime/libfaketimeMT.so.1 /faketime.so
# Verify in Alpline
FROM alpine
COPY --from=1 /faketime.so /lib/faketime.so
ENV LD_PRELOAD=/lib/faketime.so
ENV FAKETIME="-15d"
ENV DONT_FAKE_MONOTONIC=1
RUN date
# Verify with Java
FROM groovy:alpine
COPY --from=1 /faketime.so /lib/faketime.so
ENV LD_PRELOAD=/lib/faketime.so
ENV FAKETIME="-15d"
ENV DONT_FAKE_MONOTONIC=1
RUN groovy -e "new Date();"
# Build the final image
FROM scratch
COPY --from=0 /usr/local/lib/faketime/libfaketimeMT.so.1 /faketime.so