I'm using docker on one of my vue projects. I want to run the command yarn --silent
and yarn serve
back to back in my dockerfile, but it doesn't see yarn --silent
as command. Any way to fix this?
The code looks like this:
version: "3"
services:
proxy:
build:
context: ./api
dockerfile: Dockerfile
command: yarn start
volumes:
- .:/usr/app/
- /usr/app/node_modules
container_name: proxy
ports:
- "3000:3000"
app:
build:
context: ./app
dockerfile: Dockerfile
command: yarn --silent && yarn serve
ports:
- "8080:8080"
container_name: app
volumes:
- ./app:/usr/src/app
- /usr/src/app/node_modules
EDIT
When I change the command to yarn install --silent && yarn serve
I get the following error:
error 'install' has been replaced with 'add' to add new dependencies. Run "yarn add && yarn serve" instead.
but this will not install all dependencies ofcourse
You have not shared your Dockerfile
but I assume you have yarn
installed in the docker container, have you?
If so, try with replacing your command with the following:
command: bash -c "yarn --silent && yarn serve"
Note: I assume there is bash
in your container, if not replace it with with the supported one - sh
, etc.