This branch launches 3x containers: one for MongoDB, one for nginx/front end, and one for the SpringBoot API. After completing these instructions, usage is:
- For Front-end,
localhost:8081
- For API call,
localhost:8080/acronyms?bullets=<text with acronyms>
-
Install docker (
docker.io
) and add your user to thedocker
group to addsudo
rights (see https://docs.docker.com/install/linux/linux-postinstall/). -
Delete any containers named
acronym-nginx-container
,acronym-spring-app
, oracronym-mongo-db
. -
git clone
this branch -
Move into folder with Mongo Dockerfile
cd ./acronym-web-app/MongoDocker
- Create docker software-defined network (SDN)
docker network create acronym-network
- Build MongoDB Docker image named
acronym-mongo-image
docker build -t acronym-mongo-image ./
- Run MongoDB Docker image as a daemon, remove on exit, named
acronym-mongo-db
, map port 27017 on host to 27017 on container, and add to the SDN we defined.
docker run -d --rm --name acronym-mongo-db --p 27017:27017 --network acronym-network acronym-mongo-image
-
Move to springBoot directory
cd ..
-
Build Spring Boot image & run
docker build -t acronym-spring-image
docker run -d --rm --name acronym-spring-app -p 8080:8080 --network acronym-network acronym-spring-image
- Build nginx image & run (uses port 8081 on localhost for nginx http port 80)
docker build -t acronym-nginx-image
docker run -d --rm --name acronym-nginx-container -p 8081:80 --network acronym-network acronym-nginx-image
- Access the app at
localhost:8081
!