Set env variables (fetched by docker):
echo "MONGO_URI=<mongodb_url_here>" >> .env
echo "SECRET_KEY=<secret_jwt_salt_here>" >> .env
- From Dockerfile
docker build -t crwn-server:dev --target dev .
docker run --rm -it -p 8080:8080 -v $(pwd):/app/server crwn-server:dev bash
Then from container run:root@1fdb0daaa93b:/app/server# npm start
- Or run from docker-compose (without npm logs)
docker-compose up -d
-
From Dockerfile
docker build -t crwn-server --target prod . && docker run -p 8080:8080 crwn-server
-
From docker-compose
docker-compose build && docker-compose up