mkdir newproject
cd newproject
npx create-react-app client --use-npm
npx express-generator --view=ejs --git server
sudo rm -r /client.git
git init
git add .
git add remote
git push
before deleting the Dockerfile
from the root of the project, copy it to each of the client
and server
directories. Then Edit the docker-copmpose.yml
to launch both containers in the default network
at the same time on different ports
.
FROM node:10.13-alpine
ENV NODE_ENV production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production && mv node_modules ../
COPY . .
EXPOSE 3000
CMD npm start
FROM node:10.13-alpine
ENV NODE_ENV production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production && mv node_modules ../
COPY . .
EXPOSE 3000
CMD npm start
version: '2.4'
services:
client:
image: client
build: ./client
environment:
NODE_ENV: production
ports:
- 3000:3000
stdin_open: true
tty: true
server:
image: server
build: ./server
environment:
NODE_ENV: production
ports:
- 3001:3000