diff --git a/docker-compose.yml b/docker-compose.yml index c491797d..dc5134c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,43 +1,22 @@ version: '3.8' services: - mysql: - image: mysql:8.0 - environment: - MYSQL_ROOT_PASSWORD: jewelry123 - MYSQL_DATABASE: jewelry_mall - MYSQL_CHARACTER_SET_SERVER: utf8mb4 - MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci - ports: - - "3306:3306" - volumes: - - mysql_data:/var/lib/mysql - - ./server/migrations/001_init.sql:/docker-entrypoint-initdb.d/001_init.sql - healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] - interval: 5s - timeout: 5s - retries: 10 - server: build: ./server ports: - "3000:3000" environment: - DB_HOST: mysql - DB_PORT: 3306 - DB_USER: root - DB_PASSWORD: jewelry123 - DB_NAME: jewelry_mall - WX_APPID: wx58b02b73d9c26c10 - WX_SECRET: 3b6cdaffa9ef92d877f79ebd739b47b0 - JWT_SECRET: jewelry-mall-jwt-secret + DB_HOST: ${DB_HOST:-192.168.195.15} + DB_PORT: ${DB_PORT:-3306} + DB_USER: ${DB_USER:-root} + DB_PASSWORD: ${DB_PASSWORD:-root123456} + DB_NAME: ${DB_NAME:-jewelry_mall} + WX_APPID: ${WX_APPID:-wx58b02b73d9c26c10} + WX_SECRET: ${WX_SECRET:-3b6cdaffa9ef92d877f79ebd739b47b0} + JWT_SECRET: ${JWT_SECRET:-jewelry-mall-jwt-secret} PORT: 3000 volumes: - server_uploads:/app/uploads - depends_on: - mysql: - condition: service_healthy admin: build: ./admin @@ -47,5 +26,4 @@ services: - server volumes: - mysql_data: server_uploads: diff --git a/server/.dockerignore b/server/.dockerignore index fe1a3bd1..eec95fcf 100644 --- a/server/.dockerignore +++ b/server/.dockerignore @@ -3,3 +3,4 @@ dist tests *.test.ts vitest.config.ts +.env