URLShortener/docker-compose.yml
Amit Kumar Nandi 8cdb099fb6 changed dockerfile and docker-compose.yml
Main app container and db are segreegated to 2 different containers.

Modified compose file to orchestrate the containers accordingly on a single deployment
2024-02-22 00:43:50 +05:30

47 lines
969 B
YAML

version: '3.8'
volumes:
dbdata:
name: dbdata
services:
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: 1234qwer
MYSQL_DATABASE: shortener
MYSQL_USER: shortener_user
MYSQL_PASSWORD: 1234qwer
volumes:
- data:/var/lib/mysql
- type: volume
source: dbdata
target: /var/lib/mysql
- ./create.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "3306:3306"
app:
labels:
- "TUSC The URL Shortener Company"
#Build from docker hub image .Comment/Uncomment Below
image: nmpl/shortener:latest
# Build from local Dockerfile.Comment/Uncomment Below
# build:
# context: .
# dockerfile: Dockerfile
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/monitoring" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
ports:
- "8080:8080"
depends_on:
- db