Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created June 22, 2018 23:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save miguelmota/a2c528ed1c2e5e75464a793014ba882e to your computer and use it in GitHub Desktop.
Save miguelmota/a2c528ed1c2e5e75464a793014ba882e 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