Created
July 16, 2019 09:22
-
-
Save nileshgulia1/2ba77fa3ca573fc74ac46622f1ae260f to your computer and use it in GitHub Desktop.
Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
server: | |
build: ./server | |
expose: | |
- 3001 | |
environment: | |
USER_NAME: ${USER_NAME} | |
PASSWORD: ${PASSWORD} | |
ports: | |
- '3001:3001' | |
volumes: | |
- './server:/app' | |
- '/app/node_modules' | |
environment: | |
- NODE_ENV=development | |
command: yarn start:server | |
client: | |
build: ./ | |
expose: | |
- 3000 | |
ports: | |
- '3000:3000' | |
volumes: | |
- '.:/app' | |
- '/app/node_modules' | |
environment: | |
- NODE_ENV=development | |
links: | |
- server | |
command: yarn start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# base image | |
FROM node:12.2.0-alpine | |
# set working directory | |
WORKDIR /app | |
# add `/app/node_modules/.bin` to $PATH | |
ENV PATH /app/node_modules/.bin:$PATH | |
# install and cache app dependencies | |
COPY package.json /app/package.json | |
COPY . /app/ | |
RUN npm install --silent | |
RUN npm run build | |
RUN npm install -g serve | |
CMD serve -s build | |
RUN npm install [email protected] -g --silent | |
# start app | |
CMD ["npm", "start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# base image | |
FROM node:12.2.0-alpine | |
# set working directory | |
WORKDIR /app | |
# add `/app/node_modules/.bin` to $PATH | |
ENV PATH /app/node_modules/.bin:$PATH | |
# install and cache app dependencies | |
COPY package.json /app/ | |
RUN npm install | |
COPY . /app/ | |
# start app | |
CMD ["npm", "run", "start:server"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment