I'm preparing a Dockerfile that will be used in production. But for some reason, the last command is returning an error.
react_1 | [WEBPACK] Building 1 target
react_1 | [WEBPACK] Started building bundle.[chunkhash].js
react_1 | [WEBPACK] Build failed after 33.631 seconds
react_1 | [WEBPACK] Errors building bundle.[chunkhash].js
react_1 | Module not found: Error: Can't resolve './App' in '/home/app/react/src'
Here is the copy of the docker file
Dockerfile.prod
FROM node:7.10.1-alpine
RUN apk update
ENV HOME=/home/app
COPY . $HOME/react/
RUN npm install yarn -g
WORKDIR $HOME/react
RUN mkdir build && mkdir dlls && yarn
CMD ["yarn", "start:prod"]
Here's the copy of the docker-compose file
docker-compose.prod.yml
version: '3.1'
services:
react:
build:
context: .
dockerfile: Dockerfile.prod
ports:
- 3100:3100
volumes:
- /home/app/react
When I docker-compose -f docker-compose.prod.yml up --build -d it works as expected until when it builds the webpack file. But fails as you can see in the error above.
But when I do this docker-compose run react yarn start:prod the webpack builds just fine.
Here's the repo in question.
My bad. It was case sensitive errors. Since I was on windows it just went through without problems.
So the error happened because the import statement was finding App folder, but the actual folder was app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With