-
create
.envfile with recommended values like.env.example -
Build docker image
docker build . -t backend:v1
- Run backend:v1 image inside container and use database outside the docker container using below command
docker run --network host -d backend:v1
docker network create --driver=bridge --subnet=172.16.0.0/24 br0 docker run -d --network br0 -p 3000:3000 --restart unless-stopped backend:v1
-
please if you will use xammp mysql database please give root or any other user full access from any host to allow the application inside docker container accesses the database by pressing on privilage > select root user or any user > edit privilage > login information > name host and select any host
-
If you need to change app port open
Dockerfileand changeEXPOSE 3000toEXPOSE <YOUR PORT>and open.envfile and change application port to the same port you will expose in docker container and then change port same port you will expose from container in the variable calledSERVER_URLin the.envfile. then build docker image again.
create .env file with recommended values like .env.example
and Run below Command:
npm i
then Start Server using below command:
npm start