Skip to content

Commit

Permalink
Merge branch 'master' of github.com:hioa-cs/data2410_fullstack_example
Browse files Browse the repository at this point in the history
  • Loading branch information
alfreb committed May 9, 2021
2 parents 6e07e5a + 5ffd448 commit 9fc8f07
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
## Running each container with docker
This example uses the `skynet` network, created with `$ docker network create skynet`. If you want to use your own network, replace `skynet` with the name of your own network.


### Starting the database
The database uses the official MySQL docker image directly, with the contents of the `sql` directory mounted inside (e.g. the `sql` directory will be shared with the container)
Standing in the source repo, start the database like this:
```
$ docker run -it --rm -d --name mysql1 --network skynet -e MYSQL_ROOT_PASSWORD=my-secret-pw -v $(pwd)/sql:/docker-entrypoint-initdb.d mysql
```
Notice the `-d` - this will make the container run in the background. If you have docker for mac or docker for windows installed, you should be able to see a container named `mysql1` running.
Notice the `-d` - this will make the container run in the background. If you have docker for mac or docker for windows installed you should be able to see a container named `mysql1` running.

The backend, which hosts both the API and the frontend can now be started like this:
### Build and run the backend
The backend, which hosts both the API and the frontend, has a couple of python dependencies which is nice to build into the container. Build with:
```
$ docker build -t python_backend ./python_backend/
```
This will result in an image named `python_backend`. You should be able to see that with `$ docker images` or by clikcing the "Images" label in docker for desktop.
The backend can now be started like this:
```
$ docker run -it --rm --name pyback --network skynet -p 5000:5000 -v $(pwd)/python_backend/server.py:/var/fullstack/server.py -v $(pwd)/frontend/:/var/fullstack/frontend/ -t python_backend python /var/fullstack/server.py
```

## Running with docker compose
TODO
TODO

0 comments on commit 9fc8f07

Please sign in to comment.