Skip to content

lamtan93/docker-react-node-mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerizer web-app(React-Node-Mongo) with multi-containers without docker-compose

Network:

Create a network for communication between backend and mongo container

    docker network create webAppNet

Mongo:

Build image:
    docker run mongo
RUN container:
    docker run --name mongodb --rm -d --network webAppNet -v mongodata:/data/db -e MONGO_INITDB_ROOT_USERNAME=corgi -e MONGO_INITDB_ROOT_PASSWORD=secret mongo

Back:

Build image:
    docker build --tag backend-img .
RUN container:
    docker run --name nodeApp --rm -d -p 80:80 --network webAppNet -v logs:/app/logs -v /Users/lamtan/Documents/dev/git/docker-practice-multicontainer/backend:/app -v /app/node_modules -e MONGODB_USERNAME=corgi backend-img

Front:

Build image:
    docker build --tag frontend-img .
RUN container:
    docker run --name reactApp --rm -it -p 3000:3000 -v /Users/lamtan/Documents/dev/git/docker-practice-multicontainer/frontend/src:/app/src frontend-img

Absolute path of all bind volumes above must be modified depending on the machine

Ex:
    /Users/lamtan/Documents/dev/git/docker-practice-multicontainer/backend
    /Users/lamtan/Documents/dev/git/docker-practice-multicontainer/frontend/src

Note:

The version using docker-compose is on the branch with-docker-compose

About

Dockerize app with multi-container without docker-compose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors