-
-
Save tstellanova/fa11a5567221fc405b02e64f1da4c734 to your computer and use it in GitHub Desktop.
Docker faketime lib example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:8 | |
WORKDIR / | |
RUN git clone https://github.com/wolfcw/libfaketime.git | |
WORKDIR /libfaketime/src | |
RUN make install | |
WORKDIR /usr/src/app | |
COPY package.json ./ | |
RUN npm install | |
COPY . . | |
CMD ["/bin/sh", "-c", "LD_PRELOAD=/usr/local/lib/faketime/libfaketime.so.1 FAKETIME_NO_CACHE=1 faketime -f '@2017-01-01 00:00:00' npm start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('modified time', new Date()) // modified time 2017-01-01T00:00:00.052Z | |
setTimeout(() => { | |
console.log('end time', new Date()) // end time 2017-01-01T00:00:01.058Z | |
}, 1e3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment