Reputation: 139
i want to dockerize my react/ django app so i created those docker files and dockercompose when i type docker-compose up my DB and backend works fine but i'm getting an error in react ( 「wds」: Content not from webpack is served from /app/myyreactproject/public ) when i try to run the react's dockerfile without mentionning -p 3000:3000 i got the same error but when i type -p 3000:3000 it works fine i want to start my frontend without the use of "-p" because i can't use it with docker-compose any help please ?
this is my react's dockerfile :
FROM node:alpine
WORKDIR '/app/myyreactproject'
COPY package.json .
RUN npm install &&\
npm install react react-dom &&\
npm install react-confirm-alert --save &&\
npm install axios &&\
npm install jsonwebtoken &&\
npm install jwt-decode
COPY . .
EXPOSE 3000
CMD ["npm" , "start"]
and this is my dockercompose.yml
version: '3'
services:
db:
image: postgres
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=yassine123
web:
build: ./projet
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ./projet:/app/projet
ports:
- "8000:8000"
depends_on:
- db
frontend:
build: ./myyreactproject
command: ["npm", "start"]
volumes:
- ./myyreactproject:/app/myyreactproject
- node-modules:/app/myyreactproject/node_modules
ports:
- "3000:3000"
volumes:
node-modules:
Upvotes: 0
Views: 51
Reputation: 11
I got similar issue and adding
tty: true
in the .yml file, It solved my issue so try adding tty: true in your .yml file
Upvotes: 1