Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save alexlondon07/7cfbcde0559eafb3ac3b3ebdd5ce66a6 to your computer and use it in GitHub Desktop.

Select an option

Save alexlondon07/7cfbcde0559eafb3ac3b3ebdd5ce66a6 to your computer and use it in GitHub Desktop.
a docker compose file for MySql, PhpMyAdmin, SpringBoot and Angular CRUD web application
version: "3.3"
#Define services
services:
#MySql Database for application
mysql-db:
image: mysql
restart: always
container_name: mysql-db
#Environment variable for password and default database
environment:
MYSQL_ROOT_PASSWORD: 'password'
MYSQL_DATABASE: 'crud-application'
ports:
- 3306:3306 #Forwars the exposed port 3306 on the container to port 3306 on the host machine
volumes:
- ./dump.sql:/docker-entrypoint-initdb.d/dump.sql
#MySql Web UI
php-my-admin:
image: phpmyadmin
restart: always
container_name: php-my-admin
ports:
- 8081:80 #Forwars the exposed port 80 on the container to port 8081 on the host machine
environment:
PMA_HOST: mysql-db
#Back-end Spring Boot Application
springboot-app:
#The docker file in BE, build the jar and provides the docker image.
build: ./BE
container_name: springboot-app
#Environment variable for Spring Boot Application.
environment:
MYSQL_HOST: 'mysql-db'
MYSQL_USER: 'root'
MYSQL_PASSWORD: 'password'
MYSQL_DATABASE: 'crud-application'
ports:
- 8080:8080 #Forwars the exposed port 8080 on the container to port 8080 on the host machine
links:
- mysql-db
#Front-end Angular Application
angular-app:
#The docker file in FE, builds and provides the docker image.
build: ./FE
container_name: angular-app
ports:
- 4200:4200 #Forwars the exposed port 4200 on the container to port 4200 on the host machine
links:
- springboot-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment