Preparing the baseline code
First, we need to prepare our baseline code, a process very similar to that of previous chapters. Follow these steps:
- Copy all of the content from the
chapter-10folder. - Rename the folder
chapter-11. - Delete the
storage-dbfolder.
Now, let's make some changes to the docker-compose.yml file, to fit a new database and server containers.
- Open
docker-compose.ymland replace the contents with the following code:
version: "3.1"
services:
mysql:
image: mysql:5.7
container_name: chapter-11-mysql
working_dir: /application
volumes:
- .:/application
- ./storage-db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=chapter-11
- MYSQL_USER=chapter-11
- MYSQL_PASSWORD=123456
ports:
- "8083:3306"
webserver:
image: nginx:alpine
container_name: chapter-11-webserver
working_dir: /application
volumes:
- .:/application...