So I am trying to start up an server that has:
- a mongodb container
- a backend container
- a client container
Both server containers require me to run yarn start
at the end. However, when I run this in the dockerfile the image never stops being built as the yarn start
command technically never stops running.
The client requires the backend to be up already, and the backend requires the mongodb db instance to be up.
How do I get this server running in docker compose?
Here is my backend dockerfile
FROM node:12-alpine
WORKDIR /app
COPY ./server /app
WORKDIR /app/server
RUN yarn
RUN yarn start
It really does work until I get to yarn start (Which I should probably run in the docker-compose as it needs to mongodb container to be running. I just don't know how to run this in the docker-compose.yml
, or force the client to wait for this command to be run before running its own yarn start
).