Files
cmc/docker-compose.yml
T
2026-08-14 17:07:49 +05:30

82 lines
2.3 KiB
YAML

version: '3.8'
services:
backend:
build:
context: support-portal-backend
dockerfile: Dockerfile
restart: always
ports:
- "8080:8080"
environment:
MYSQL_HOST: db
MYSQL_USER: support_portal_user
MYSQL_PASSWORD: support_portal_password
MYSQL_DATABASE: support-portal
# ✅ Activate production profile and enforce HTTPS base URL
SPRING_PROFILES_ACTIVE: production
APP_BASE_URL: https://cmcbackend.rootxwire.com
# ✅ Optional: ensures Spring detects HTTPS correctly behind reverse proxy
SERVER_FORWARD_HEADERS_STRATEGY: native
volumes:
# Persist uploaded images and files.
# This same named volume is mounted at TWO paths on purpose:
# - /app/uploads: hardcoded in FileConstant.java for hero/professor/
# user avatar images (does NOT read file.upload.directory).
# - /var/uploads/blog-images: read from file.upload.directory
# (application.yml production profile) for blog post images.
# The volume already contains hero/ and user/ subfolders plus the
# blog post images at its root from before this was mounted twice —
# mounting both paths makes all of it visible again with no data
# migration needed. Do not change either path without updating the
# other or the corresponding app config.
- blog-uploads:/app/uploads
- blog-uploads:/var/uploads/blog-images
networks:
- angular-spring
- spring-mysql
depends_on:
db:
condition: service_healthy
db:
image: mysql:8.0.19
restart: always
environment:
MYSQL_USER: support_portal_user
MYSQL_PASSWORD: support_portal_password
MYSQL_DATABASE: support-portal
MYSQL_ROOT_PASSWORD: root_password
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
interval: 3s
retries: 5
start_period: 30s
volumes:
- db-data:/var/lib/mysql
networks:
- spring-mysql
frontend:
build:
context: support-portal-frontend
dockerfile: Dockerfile
restart: always
ports:
- "8072:80"
networks:
- angular-spring
depends_on:
- backend
volumes:
db-data: {}
blog-uploads: {}
networks:
angular-spring: {}
spring-mysql: {}