Skip to content

Instantly share code, notes, and snippets.

@siteslave
Created April 22, 2021 07:47
Show Gist options
  • Save siteslave/1d4d97abca33262f461fc867e7ba74dd to your computer and use it in GitHub Desktop.
Save siteslave/1d4d97abca33262f461fc867e7ba74dd to your computer and use it in GitHub Desktop.

process.json


{
  "apps": [
    {
      "name": "api",
      "script": "/home/api/dist/main.js",
      "instances": 4,
      "exec_mode": "cluster"
    }
  ]
}

dockerfile

FROM keymetrics/pm2:10-alpine

LABEL maintainer="Satit Rianpit <[email protected]>"

WORKDIR /home/api

RUN apk update && apk upgrade && apk add --no-cache alpine-sdk git \
  openssh \
  python \
  tzdata \
  build-base \
  libtool \
  autoconf \
  automake \
  gzip \
  g++ \
  make \
  && cp /usr/share/zoneinfo/Asia/Bangkok /etc/localtime \
  && echo "Asia/Bangkok" > /etc/timezone

COPY . .

RUN npm i && npm run build

CMD ["pm2-runtime", "process.json"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment