mirror of
https://github.com/docker/awesome-compose.git
synced 2025-04-29 15:48:03 +02:00
add react-express-mysql application sample
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
This commit is contained in:
parent
0d06c37791
commit
43f21f2d8d
46 changed files with 4786 additions and 0 deletions
36
samples/react-express-mysql/backend/Dockerfile
Executable file
36
samples/react-express-mysql/backend/Dockerfile
Executable file
|
@ -0,0 +1,36 @@
|
|||
# if you're doing anything beyond your local machine, please pin this to a specific version at https://hub.docker.com/_/node/
|
||||
FROM node:10
|
||||
|
||||
RUN mkdir -p /opt/app
|
||||
|
||||
# set our node environment, either development or production
|
||||
# defaults to production, compose overrides this to development on build and run
|
||||
ARG NODE_ENV=production
|
||||
ENV NODE_ENV $NODE_ENV
|
||||
|
||||
# default to port 80 for node, and 9229 and 9230 (tests) for debug
|
||||
ARG PORT=80
|
||||
ENV PORT $PORT
|
||||
EXPOSE $PORT 9229 9230
|
||||
|
||||
# you'll likely want the latest npm, reguardless of node version, for speed and fixes
|
||||
RUN npm i npm@latest -g
|
||||
|
||||
# install dependencies first, in a different location for easier app bind mounting for local development
|
||||
WORKDIR /opt
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install && npm cache clean --force
|
||||
ENV PATH /opt/node_modules/.bin:$PATH
|
||||
|
||||
# check every 30s to ensure this service returns HTTP 200
|
||||
HEALTHCHECK --interval=30s CMD node healthcheck.js
|
||||
|
||||
# copy in our source code last, as it changes the most
|
||||
WORKDIR /opt/app
|
||||
COPY . /opt/app
|
||||
|
||||
# if you want to use npm start instead, then use `docker run --init in production`
|
||||
# so that signals are passed properly. Note the code in index.js is needed to catch Docker signals
|
||||
# using node here is still more graceful stopping then npm with --init afaik
|
||||
# I still can't come up with a good production way to run with npm and graceful shutdown
|
||||
CMD [ "node", "index.js" ]
|
Loading…
Add table
Add a link
Reference in a new issue