https://github.com/andreastedile/sde
Demonstration of Docker and Docker compose basic usage for the Service Design and Engineering course
https://github.com/andreastedile/sde
Last synced: about 1 month ago
JSON representation
Demonstration of Docker and Docker compose basic usage for the Service Design and Engineering course
- Host: GitHub
- URL: https://github.com/andreastedile/sde
- Owner: andreastedile
- Created: 2020-11-04T16:45:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-11T20:23:11.000Z (over 5 years ago)
- Last Synced: 2025-03-03T04:26:10.766Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 1.92 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Voting App
Clone the repository:
```
$ git clone https://github.com/andreastedile/sde
```
All the following commands must be issued from the project's root directory.
## Manual build
```
$ docker build -t dbapi db_api
$ docker build -t voteapi vote_api
$ docker build -t resultsapi results_api
```
## Manual run
```
$ docker network create voting-app-net
$ docker run \
-e "POSTGRES_USER=postgres" \
-e "POSTGRES_PASSWORD=password" \
-e "POSTGRES_DB=dbvotes" \
-v $(pwd)/db_api/init.sql:/docker-entrypoint-initdb.d/init.sql \
--network voting-app-net \
--hostname db \
--name db \
-d \
postgres
$ docker run \
-e "DB_HOST=db" \
-e "DB_USER=postgres" \
-e "DB_PASSWORD=password" \
-e "POSTGRES_DB=dbvotes" \
-p 5000:80 \
--network voting-app-net \
--hostname dbapi \
--name dbapi \
-d \
dbapi
$ docker run \
-e "DB_HOST=dbapi" \
-p 7000:80 \
--network voting-app-net \
--hostname voteapi \
--name voteapi \
-d \
voteapi
$ docker run \
-e "DB_HOST=dbapi" \
-p 8000:80 \
--network voting-app-net \
--hostname resultsapi \
--name resultsapi \
-d \
resultsapi
```
## Automatic build
```
$ docker-compose build
```
## Automatic run
```
$ docker-compose up
```