-
-
Save GbengaElebs/7f6fa7996e2e65bc770644fbc6ebe911 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Please refer https://aka.ms/HTTPSinContainer on how to setup an https developer certificate for your ASP .NET Core service. | |
version: '3.4' | |
#create a volume for the my sql container.To ensure Data persists after my sql container is stopped | |
volumes: | |
datafiles: | |
services: | |
#DataBase Service | |
database: | |
#Pull the latest mysql image | |
image: mysql:8.0.22 | |
#Map port 3306 on the mysql container to port 3306 in the host | |
ports: | |
- "3306:3306" | |
#Specify where the persisted Data should be stored | |
volumes: | |
- datafiles:/var/lib/mysql | |
- "~/sql-scripts/setup.sql:/docker-entrypoint-initdb.d/1.sql" | |
restart: always | |
#Specify Environment Variables for mysql | |
environment: | |
MYSQL_ROOT_PASSWORD: Root0++ | |
MYSQL_USER: newuser | |
MYSQL_PASSWORD: pass@word1234 | |
MYSQL_DATABASE: Usersdb | |
#Api Service | |
api: | |
build: | |
context: . | |
#Use the DockerFile in that Directory | |
dockerfile: Dockerfile | |
#This Service Depends on the database service specifed above | |
depends_on: | |
- database | |
#Map port 8888 in the docker container to port 80 in the Api | |
ports: | |
- "5000:80" | |
restart: always | |
#Specify Environment Variables for the Api Service | |
environment: | |
- DBHOST=database | |
- ASPNETCORE_ENVIRONMENT=Development |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment