Skip to content

Instantly share code, notes, and snippets.

@tstellanova
Forked from miguelmota/Dockerfile
Last active January 17, 2019 04:25
Show Gist options
  • Save tstellanova/fa11a5567221fc405b02e64f1da4c734 to your computer and use it in GitHub Desktop.
Save tstellanova/fa11a5567221fc405b02e64f1da4c734 to your computer and use it in GitHub Desktop.
Docker faketime lib example
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"]
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