diff --git a/.env b/.env index 6f6637b..7885af4 100644 --- a/.env +++ b/.env @@ -1,9 +1,9 @@ # Frontend -FRONTEND_PORT=3000 +DIALECTIC_FRONTEND_PORT=3000 # Backend -BACKEND_PORT=8090 -BACKEND_URL=http://localhost:8090 +DIALECTIC_BACKEND_PORT=8090 +DIALECTIC_BACKEND_URL=http://localhost:8090 # Database DB_PORT=3306 diff --git a/Dialectic.Backend b/Dialectic.Backend index 5972267..e049b1c 160000 --- a/Dialectic.Backend +++ b/Dialectic.Backend @@ -1 +1 @@ -Subproject commit 5972267d186731bdee00f3027f7a78b0ad1505d6 +Subproject commit e049b1c4bdb71e4ce221a3a880b12bb242b5b108 diff --git a/Dialectic.Frontend b/Dialectic.Frontend index bd03492..f9665c9 160000 --- a/Dialectic.Frontend +++ b/Dialectic.Frontend @@ -1 +1 @@ -Subproject commit bd03492ef477e2f9548b816382febed58832225a +Subproject commit f9665c92cee52f7a2ebeada3d2cd04627246dc18 diff --git a/docker-compose.yaml b/docker-compose.yaml index 7f1cfef..0fe0468 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,19 +4,18 @@ services: context: ./Dialectic.Frontend dockerfile: Dockerfile ports: - - "${FRONTEND_PORT:-3000}:3000" + - "${DIALECTIC_FRONTEND_PORT:-3000}:3000" environment: - - NODE_ENV=development - - REACT_APP_BACKEND_HOST=${BACKEND_URL:-http://localhost:8000} - stdin_open: true - tty: true + - DIALECTIC_REACT_APP_BACKEND_HOST=${DIALECTIC_BACKEND_URL:-http://localhost:8000} + networks: + - app-network backend: build: context: ./Dialectic.Backend dockerfile: Dockerfile ports: - - "${BACKEND_PORT:-8000}:8000" + - "${DIALECTIC_BACKEND_PORT:-8000}:8000" volumes: - dialectic_config:/app/config environment: @@ -26,7 +25,8 @@ services: depends_on: db: condition: service_healthy - command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload + networks: + - app-network db: image: mysql:8.0 @@ -45,7 +45,12 @@ services: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] timeout: 20s retries: 10 - + networks: + - app-network volumes: mysql_data: - dialectic_config: \ No newline at end of file + dialectic_config: + +networks: + app-network: + driver: bridge \ No newline at end of file diff --git a/docker-publish b/docker-publish new file mode 100644 index 0000000..11ba9a6 --- /dev/null +++ b/docker-publish @@ -0,0 +1,40 @@ +#!/bin/bash +cd "$(dirname "$0")" + +BUILD_BACKEND=false +BUILD_FRONTEND=false + +if [ $# -eq 0 ]; then + BUILD_BACKEND=true + BUILD_FRONTEND=true +else + for arg in "$@"; do + case $arg in + --backend) + BUILD_BACKEND=true + ;; + --frontend) + BUILD_FRONTEND=true + ;; + *) + echo "unknown:$arg" + echo "usage: $0 [ --backend | --frontend ]" + exit 1 + ;; + esac + done +fi + +if [ "$BUILD_BACKEND" = true ]; then + cd Dialectic.Backend + docker build -t git.hangman-lab.top/hzhang/dialectic-backend:latest . + docker push git.hangman-lab.top/hzhang/dialectic-backend:latest + cd .. +fi + +if [ "$BUILD_FRONTEND" = true ]; then + cd Dialectic.Frontend + docker build -t git.hangman-lab.top/hzhang/dialectic-frontend:latest . + docker push git.hangman-lab.top/hzhang/dialectic-frontend:latest + cd .. +fi \ No newline at end of file