Created
December 7, 2022 20:41
-
-
Save twiddler/7deb70deec62b298738858cee5aa00bb to your computer and use it in GitHub Desktop.
Dockerized node app cannot access its own node_modules if node_modules is missing on host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:18-alpine | |
WORKDIR /app | |
COPY package*.json ./ | |
RUN npm i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rmdir node_modules | |
sudo docker build . --tag bug | |
sudo docker run -v $(pwd):/app:ro -v /app/node_modules bug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rmdir node_modules | |
sudo docker build . --tag bug | |
mkdir node_modules | |
sudo docker run -v $(pwd):/app:ro -v /app/node_modules bug |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment