Can we add graceful shutdown to the project? So when I press Control + C(Sends SIGINT), the graceful shutdown should begin. It should drain the current workers and stop accepting new connections.
When all workers are freed up, it should terminate the main process.
Dockerfile used
FROM node:6.9.2
ENV APP_DIR /home/app/frontend/
RUN mkdir -p $APP_DIR
# Install yarn
RUN npm install --global yarn@0.23.3
ENV PATH "$PATH:/opt/yarn/bin"
ADD package.json yarn.lock /tmp/
# Install packages
RUN cd /tmp && yarn
ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}
# Copy the code
COPY . $APP_DIR
WORKDIR $APP_DIR
RUN ln -s /tmp/node_modules
# Create a mount point for node_modules but not mount when running the docker image
# adapted from http://jdlm.info/articles/2016/03/06/lessons-building-node-app-docker.html
VOLUME /home/app/frontend/node_modules/
# set the node env after install or only prod dependencies will be installed
EXPOSE 3000
ENTRYPOINT ["/usr/local/bin/yarn", "run"]
CMD ["start"]
Can we add graceful shutdown to the project? So when I press
Control + C
(SendsSIGINT
), the graceful shutdown should begin. It should drain the current workers and stop accepting new connections. When all workers are freed up, it should terminate the main process.Dockerfile used