Open TurtleWolfe opened 4 years ago
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
bit.ly/CRA-deploy
volumes:
database_data:
driver: local
volumes:
- database_data:/var/lib/postgresql/data
volumes:
- ./frontend/src:/usr/src/app/src
- ./frontend/public:/usr/src/app/public
volumes:
- ./frontend:/app
# One-way volume to use node_modules from inside image
- /app/node_modules
# build environment
FROM node:13.12.0-alpine as build
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install app dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm ci --silent
RUN npm install react-scripts@3.4.1 -g --silent
COPY . ./
RUN npm run build
# production environment
FROM nginx:stable-alpine
COPY --from=build /app/build /usr/share/nginx/html
# new
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
version: '2'
services:
server:
build:
context: ./server/
command: /usr/app/node_modules/.bin/nodemon src/index.js
volumes:
- ./server/:/usr/app
- /usr/app/node_modules
ports:
- "8080:8080"
# env_file: ./server/.env # TODO - uncomment this to auto-load your .env file!
environment:
- NODE_ENV=development
- CHOKIDAR_USEPOLLING=true
client:
build:
context: ./client/
command: npm start
volumes:
- ./client/:/usr/app
- /usr/app/node_modules
depends_on:
- server
ports:
- "3000:3000"
please don't try this at home
serve -s build
NGINX: " "
app
modules
bin
modules
package.json
homepage: " "
"proxy": "http://backend:8000"
CHOKIDAR
v3
node14
-e CHOKIDAR_USEPOLLING=true
enables a polling mechanism via chokidar (which wraps fs.watch, fs.watchFile, and fsevents) so that hot-reloading will work.nginx user
configuration
traefik
bash.rc
patch.js