From f487427b2c4f1ac0b4f7b885a654cf310f56eef6 Mon Sep 17 00:00:00 2001 From: louiscklaw Date: Wed, 11 Jun 2025 12:37:22 +0800 Subject: [PATCH] "update service port configuration and docker setup" --- 01_Requirements/REQ0180/index.md | 16 ++++++++++++++++ 03_source/docker/99_prod.sh | 15 +++++++++++++++ 03_source/docker/docker-compose.dev.yml | 11 ++++++++--- 03_source/docker/docker-compose.yml | 25 +++++++++++-------------- 4 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 01_Requirements/REQ0180/index.md create mode 100755 03_source/docker/99_prod.sh diff --git a/01_Requirements/REQ0180/index.md b/01_Requirements/REQ0180/index.md new file mode 100644 index 0000000..b038f2b --- /dev/null +++ b/01_Requirements/REQ0180/index.md @@ -0,0 +1,16 @@ +--- +tags: docker, ports +--- + +# REQ0180 service port schedule + +## Port Usage + +| Service | Host Port | Container Port | Environment | Purpose | +| ----------- | --------- | -------------- | ----------- | -------------------------------- | +| Frontend | 10001 | 8080 | All | Web application access | +| Mobile | 10004 | 3000 | All | Mobile application access | +| CMS Backend | 10002 | 7272 | All | Main API access | +| CMS Backend | 10003 | 5555 | All | Additional service access | +| Postgres | - | 5432 | Production | Database access (container only) | +| Postgres | 5432 | 5432 | Development | Database access | diff --git a/03_source/docker/99_prod.sh b/03_source/docker/99_prod.sh new file mode 100755 index 0000000..3ae8736 --- /dev/null +++ b/03_source/docker/99_prod.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -ex + +# -f docker-compose.db.yml +DOCKER_COMPOSE_FILES=" -f docker-compose.yml" + +# docker compose $DOCKER_COMPOSE_FILES build +docker compose $DOCKER_COMPOSE_FILES up -d + +# cd ../api_server +# yarn docker:dev +# cd .. + +# docker compose $DOCKER_COMPOSE_FILES logs -f diff --git a/03_source/docker/docker-compose.dev.yml b/03_source/docker/docker-compose.dev.yml index 4130207..7cc73f3 100644 --- a/03_source/docker/docker-compose.dev.yml +++ b/03_source/docker/docker-compose.dev.yml @@ -1,9 +1,14 @@ services: frontend: - command: "sleep infinity" + command: 'sleep infinity' mobile: - command: "sleep infinity" + command: 'sleep infinity' cms_backend: - command: "sleep infinity" + command: 'sleep infinity' + + postgres: + # container_name: postgres + ports: + - '5432:5432' diff --git a/03_source/docker/docker-compose.yml b/03_source/docker/docker-compose.yml index 397638f..f5d7f6c 100644 --- a/03_source/docker/docker-compose.yml +++ b/03_source/docker/docker-compose.yml @@ -8,22 +8,22 @@ services: build: ../frontend # user: 1000:1000 ports: - - 8080:8080 + - 10001:8080 volumes: - ../frontend:/app - working_dir: "/app" - command: "yarn dev" + working_dir: '/app' + command: './dev.sh' mobile: image: 192.168.10.61:5000/hksingleparty_mobile build: ../mobile # user: 1000:1000 ports: - - 8081:3000 + - 10004:3000 volumes: - ../mobile:/app - working_dir: "/app" - command: "npm run dev" + working_dir: '/app' + command: './dev.sh' cms_backend: image: 192.168.10.61:5000/demo_minimal_kit_backend @@ -32,22 +32,19 @@ services: env_file: - .env ports: - - 7272:7272 - - 5555:5555 + - 10002:7272 + - 10003:5555 volumes: - ../cms_backend:/app - working_dir: "/app" - command: "yarn dev" + working_dir: '/app' + command: './dev.sh' postgres: - container_name: postgres image: postgres:14.1-alpine restart: unless-stopped env_file: - .env expose: - - "5432" - ports: - - "5432:5432" + - '5432' volumes: - db:/var/lib/postgresql/data