dvdzkwsk / react-redux-starter-kit

Get started with React, Redux, and React-Router.
MIT License
10.29k stars 2.2k forks source link

feat(node): Control + C not working when running in docker container #1230

Closed lihan closed 7 years ago

lihan commented 7 years ago

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"]
lihan commented 7 years ago

Updated Dockerfile used to reproduce the problem

lihan commented 7 years ago

Issue relate to https://github.com/npm/npm/issues/4603