fix: bake schema.sql into db image to fix Coolify bind mount error

Bind mount ./schema.sql created a directory instead of file in Coolify,
causing MySQL batch_readline error. Use Dockerfile.db to COPY schema
directly into the image instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
GuavaPopper
2026-06-12 11:39:33 +07:00
parent 001f790ce6
commit cb5598d711
2 changed files with 5 additions and 2 deletions
+2
View File
@@ -0,0 +1,2 @@
FROM mysql:8.0
COPY schema.sql /docker-entrypoint-initdb.d/schema.sql
+3 -2
View File
@@ -24,7 +24,9 @@ services:
start_period: 30s
db:
image: mysql:8.0
build:
context: .
dockerfile: Dockerfile.db
restart: unless-stopped
environment:
MYSQL_DATABASE: "${DB_NAME:-webgis_jalan}"
@@ -33,7 +35,6 @@ services:
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD:?Set DB_ROOT_PASSWORD in Coolify}"
volumes:
- mysql-data:/var/lib/mysql
- ./schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -uroot -p\"$${MYSQL_ROOT_PASSWORD}\" --silent"]
interval: 5s