Skip to content

Instantly share code, notes, and snippets.

View mixth's full-sized avatar

Narat S mixth

View GitHub Profile
# This will be referred as 0
FROM <NAME>
...
# This will be referred as 1
FROM <NAME>
...
FROM <NAME>
COPY --from=0 /home/node/app .
# Using node as intermediate to build
FROM node:8.9.3 as build-image
LABEL maintainer Narat S <narat.s@hbot.io>
WORKDIR /home/node/app
COPY . ./
RUN npm install
RUN npm run build
@mixth
mixth / retry-promise-example.js
Last active June 9, 2017 10:43
Retry-Promise | I'm trying to achieve a fail-then-wait-and-retry scenario for promise execution. My version uses reduce and chain the next setTimeout with execution using catch().
const retryPromise = require("./retry-promise");
// Execution example
retryPromise(doSomething, 5, 1000)
.then(() => {
console.log("SUCCEED!");
})
.catch(() => {
console.log("FAILED! after those tries, I gave up.");
});