Created
June 22, 2018 23:22
-
-
Save miguelmota/a2c528ed1c2e5e75464a793014ba882e 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