egg icon indicating copy to clipboard operation
egg copied to clipboard

Dockerizing egg.js

Open sm2017 opened this issue 4 years ago • 3 comments

Is the following steps enough to Dockerizing egg.js application?

Removing --daemon in the start script in the package.json

  "scripts": {
    "start": "egg-scripts start --title=egg-server-app",
  },

Using the following docker file

FROM node:16

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

EXPOSE 80
CMD [ "npm", "run" , "start" ]

I am asking about CMD [ "npm", "run" , "start" ] part

sm2017 avatar Nov 29 '21 14:11 sm2017

Can you please help be about features like HEALTHCHECK

is the following enough

HEALTHCHECK --interval=5m --timeout=3s \
  CMD curl -f http://localhost/ || exit 1

sm2017 avatar Nov 29 '21 14:11 sm2017

Can you please explain a bit about Multi-Process Development Model Enhancement in docker

sm2017 avatar Nov 29 '21 14:11 sm2017

移除--daemon 后可以在docker容器下运行。 但是存在一个日志收集的问题。docker log显示无法有效的进行日志收集,是否是因为egg-log组件未进行输出,而只是存储了文件?

zhangxuchuan827 avatar Jun 24 '22 07:06 zhangxuchuan827