Reputation: 1385
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.
Upvotes: 3
Views: 3750
Reputation: 1385
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
.
Upvotes: 4