As the name of the title, I am trying to run the container using docker compose up
but will failed since it couldn’t find the dist folder of one of the workpace packages.
folder structure:
- packages
|- package-a
- package.json
package.json
{
"workspaces": {
"packages": [
"packages/*"
]
},
}
Dockerfile:
FROM node:12.19.0
RUN mkdir /src
WORKDIR /src
RUN npm install -g typescript
COPY . .
RUN yarn install
RUN yarn workspace-packages
CMD ["yarn", "dev"]
Docker Comose file:
version: '3.9'
networks:
public:
services:
api:
build: .
container_name: api
volumes:
- .:/src
- /src/node_modules
ports:
- "8443:8443"
networks:
- public
with this settings, when running docker compose up -V
it will log an error of cannot find package-a dist folder.
When checking inside the container node_modules and check package-a folder only some fie and folder exist
- package.json
- src
- tsconfig.json
but when I try to change the docker-compose.yml to:
version: '3.9'
networks:
public:
services:
api:
build: .
container_name: api
command: ping google.com
volumes:
- /src/node_modules
ports:
- "8443:8443"
networks:
- public
and checking again inside node_modules package-a folder i can find all files including the dist folder:
- dist
- node_modules
- package.json
- src
- tsconfig.json
is there reason why it is showing like this? or I am missing something in the setting?