暂存提交
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
name: firstleg-${DEPLOY_ENV:-test}
|
||||
|
||||
x-common: &common
|
||||
restart: unless-stopped
|
||||
networks: [firstleg-network]
|
||||
environment: &common-environment
|
||||
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-cn}
|
||||
NACOS_SERVER_ADDR: ${NACOS_SERVER_ADDR}
|
||||
NACOS_USERNAME: ${NACOS_USERNAME}
|
||||
NACOS_PASSWORD: ${NACOS_PASSWORD}
|
||||
NACOS_GROUP: ${NACOS_GROUP:-BAIYUE}
|
||||
NACOS_NAMESPACE: ${NACOS_NAMESPACE:-public}
|
||||
REDIS_HOST: ${REDIS_HOST}
|
||||
REDIS_PORT: ${REDIS_PORT:-6379}
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
REDIS_DATABASE: ${REDIS_DATABASE:-0}
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
INTERNAL_SERVICE_TOKEN: ${INTERNAL_SERVICE_TOKEN}
|
||||
REGION_CODE: ${REGION_CODE:-CN}
|
||||
DEPLOYMENT_CELL: ${DEPLOYMENT_CELL:-test-cn}
|
||||
DATA_RESIDENCY: ${DATA_RESIDENCY:-CN}
|
||||
TZ: Asia/Shanghai
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
max-file: "5"
|
||||
|
||||
services:
|
||||
gateway:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/gateway:${IMAGE_TAG}
|
||||
container_name: firstleg-gateway
|
||||
ports: ["${GATEWAY_PORT:-9000}:9000"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9000
|
||||
SWAGGER_ENABLED: ${SWAGGER_ENABLED:-false}
|
||||
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS}
|
||||
CORS_ALLOW_CREDENTIALS: ${CORS_ALLOW_CREDENTIALS:-false}
|
||||
|
||||
auth:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/auth:${IMAGE_TAG}
|
||||
container_name: firstleg-auth
|
||||
ports: ["${AUTH_PORT:-9100}:9100"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9100
|
||||
AUTH_DB_URL: ${AUTH_DB_URL}
|
||||
AUTH_DB_USERNAME: ${AUTH_DB_USERNAME}
|
||||
AUTH_DB_PASSWORD: ${AUTH_DB_PASSWORD}
|
||||
|
||||
iam:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/iam:${IMAGE_TAG}
|
||||
container_name: firstleg-iam
|
||||
ports: ["${IAM_PORT:-9201}:9201"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9201
|
||||
IAM_DB_URL: ${IAM_DB_URL}
|
||||
IAM_DB_USERNAME: ${IAM_DB_USERNAME}
|
||||
IAM_DB_PASSWORD: ${IAM_DB_PASSWORD}
|
||||
|
||||
firstleg:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/firstleg:${IMAGE_TAG}
|
||||
container_name: firstleg-business
|
||||
ports: ["${FIRSTLEG_PORT:-9202}:9202"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9202
|
||||
FIRSTLEG_DB_URL: ${FIRSTLEG_DB_URL}
|
||||
FIRSTLEG_DB_USERNAME: ${FIRSTLEG_DB_USERNAME}
|
||||
FIRSTLEG_DB_PASSWORD: ${FIRSTLEG_DB_PASSWORD}
|
||||
|
||||
order:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/order:${IMAGE_TAG}
|
||||
container_name: firstleg-order
|
||||
ports: ["${ORDER_PORT:-9204}:9204"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9204
|
||||
ORDER_DB_URL: ${ORDER_DB_URL}
|
||||
ORDER_DB_USERNAME: ${ORDER_DB_USERNAME}
|
||||
ORDER_DB_PASSWORD: ${ORDER_DB_PASSWORD}
|
||||
|
||||
warehouse:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/warehouse:${IMAGE_TAG}
|
||||
container_name: firstleg-warehouse
|
||||
ports: ["${WAREHOUSE_PORT:-9205}:9205"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9205
|
||||
WAREHOUSE_DB_URL: ${WAREHOUSE_DB_URL}
|
||||
WAREHOUSE_DB_USERNAME: ${WAREHOUSE_DB_USERNAME}
|
||||
WAREHOUSE_DB_PASSWORD: ${WAREHOUSE_DB_PASSWORD}
|
||||
|
||||
file:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/file:${IMAGE_TAG}
|
||||
container_name: firstleg-file
|
||||
ports: ["${FILE_PORT:-9206}:9206"]
|
||||
volumes: ["firstleg-file-data:/data/files"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9206
|
||||
FILE_DB_URL: ${FILE_DB_URL}
|
||||
FILE_DB_USERNAME: ${FILE_DB_USERNAME}
|
||||
FILE_DB_PASSWORD: ${FILE_DB_PASSWORD}
|
||||
FILE_STORAGE_ROOT: /data/files
|
||||
|
||||
print:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/print:${IMAGE_TAG}
|
||||
container_name: firstleg-print
|
||||
ports: ["${PRINT_PORT:-9207}:9207"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9207
|
||||
PRINT_DB_URL: ${PRINT_DB_URL}
|
||||
PRINT_DB_USERNAME: ${PRINT_DB_USERNAME}
|
||||
PRINT_DB_PASSWORD: ${PRINT_DB_PASSWORD}
|
||||
|
||||
integration-service:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/integration-service:${IMAGE_TAG}
|
||||
container_name: firstleg-integration
|
||||
ports: ["${INTEGRATION_PORT:-9210}:9210"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9210
|
||||
BAIDU_OCR_ENABLED: ${BAIDU_OCR_ENABLED:-false}
|
||||
BAIDU_OCR_API_KEY: ${BAIDU_OCR_API_KEY:-}
|
||||
BAIDU_OCR_SECRET_KEY: ${BAIDU_OCR_SECRET_KEY:-}
|
||||
AMAZON_SP_API_ENABLED: ${AMAZON_SP_API_ENABLED:-false}
|
||||
AMAZON_SP_API_CLIENT_ID: ${AMAZON_SP_API_CLIENT_ID:-}
|
||||
AMAZON_SP_API_CLIENT_SECRET: ${AMAZON_SP_API_CLIENT_SECRET:-}
|
||||
AMAZON_SP_API_REFRESH_TOKEN: ${AMAZON_SP_API_REFRESH_TOKEN:-}
|
||||
AMAZON_SP_API_AWS_ACCESS_KEY: ${AMAZON_SP_API_AWS_ACCESS_KEY:-}
|
||||
AMAZON_SP_API_AWS_SECRET_KEY: ${AMAZON_SP_API_AWS_SECRET_KEY:-}
|
||||
AMAZON_SP_API_REGION: ${AMAZON_SP_API_REGION:-}
|
||||
|
||||
event-bridge-service:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/event-bridge-service:${IMAGE_TAG}
|
||||
container_name: firstleg-event-bridge
|
||||
ports: ["${EVENT_BRIDGE_PORT:-9300}:9300"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9300
|
||||
EVENT_BRIDGE_DB_URL: ${EVENT_BRIDGE_DB_URL}
|
||||
EVENT_BRIDGE_DB_USERNAME: ${EVENT_BRIDGE_DB_USERNAME}
|
||||
EVENT_BRIDGE_DB_PASSWORD: ${EVENT_BRIDGE_DB_PASSWORD}
|
||||
|
||||
audit-service:
|
||||
<<: *common
|
||||
image: ${IMAGE_REPOSITORY}/audit-service:${IMAGE_TAG}
|
||||
container_name: firstleg-audit
|
||||
ports: ["${AUDIT_PORT:-9700}:9700"]
|
||||
environment:
|
||||
<<: *common-environment
|
||||
SERVER_PORT: 9700
|
||||
AUDIT_DB_URL: ${AUDIT_DB_URL}
|
||||
AUDIT_DB_USERNAME: ${AUDIT_DB_USERNAME}
|
||||
AUDIT_DB_PASSWORD: ${AUDIT_DB_PASSWORD}
|
||||
|
||||
networks:
|
||||
firstleg-network:
|
||||
name: firstleg-${DEPLOY_ENV:-test}-network
|
||||
|
||||
volumes:
|
||||
firstleg-file-data:
|
||||
name: firstleg-${DEPLOY_ENV:-test}-file-data
|
||||
@@ -0,0 +1,22 @@
|
||||
FROM eclipse-temurin:17-jre-alpine
|
||||
|
||||
RUN apk add --no-cache curl \
|
||||
&& addgroup -S app \
|
||||
&& adduser -S -G app -u 10001 app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ARG JAR_FILE
|
||||
COPY --chown=app:app ${JAR_FILE} /app/app.jar
|
||||
|
||||
USER app
|
||||
|
||||
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -XX:+ExitOnOutOfMemoryError -Dfile.encoding=UTF-8" \
|
||||
SERVER_PORT=8080
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
||||
CMD curl -fsS "http://127.0.0.1:${SERVER_PORT}/actuator/health" || exit 1
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /app/app.jar"]
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 5 ]; then
|
||||
echo "用法: $0 <环境> <镜像仓库> <镜像标签> <逗号分隔服务> <环境文件>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
DEPLOY_ENV="$1"
|
||||
IMAGE_REPOSITORY="$2"
|
||||
IMAGE_TAG="$3"
|
||||
SERVICE_CSV="$4"
|
||||
ENV_FILE="$5"
|
||||
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
echo "环境文件不存在: $ENV_FILE" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
SERVICES=$(printf '%s' "$SERVICE_CSV" | tr ',' ' ')
|
||||
case " $SERVICES " in
|
||||
*" gateway "*) SERVICES="$SERVICES" ;;
|
||||
*) SERVICES="$SERVICES gateway" ;;
|
||||
esac
|
||||
|
||||
export DEPLOY_ENV IMAGE_REPOSITORY IMAGE_TAG
|
||||
docker compose \
|
||||
--project-name "firstleg-${DEPLOY_ENV}" \
|
||||
--env-file "$ENV_FILE" \
|
||||
-f deploy/docker-compose.yml \
|
||||
pull $SERVICES
|
||||
|
||||
docker compose \
|
||||
--project-name "firstleg-${DEPLOY_ENV}" \
|
||||
--env-file "$ENV_FILE" \
|
||||
-f deploy/docker-compose.yml \
|
||||
up -d --remove-orphans $SERVICES
|
||||
|
||||
docker compose \
|
||||
--project-name "firstleg-${DEPLOY_ENV}" \
|
||||
--env-file "$ENV_FILE" \
|
||||
-f deploy/docker-compose.yml \
|
||||
ps $SERVICES
|
||||
@@ -0,0 +1,45 @@
|
||||
services:
|
||||
gateway:
|
||||
artifactId: gateway
|
||||
jar: gateway/target/gateway-1.0.0-SNAPSHOT.jar
|
||||
port: 9000
|
||||
auth:
|
||||
artifactId: auth-service
|
||||
jar: auth/target/auth-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9100
|
||||
iam:
|
||||
artifactId: iam-service
|
||||
jar: iam/target/iam-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9201
|
||||
firstleg:
|
||||
artifactId: firstleg-service
|
||||
jar: firstleg/target/firstleg-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9202
|
||||
order:
|
||||
artifactId: order-service
|
||||
jar: order/target/order-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9204
|
||||
warehouse:
|
||||
artifactId: warehouse-service
|
||||
jar: warehouse/target/warehouse-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9205
|
||||
file:
|
||||
artifactId: file-service
|
||||
jar: file/target/file-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9206
|
||||
print:
|
||||
artifactId: print-service
|
||||
jar: print/target/print-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9207
|
||||
integration-service:
|
||||
artifactId: integration-service
|
||||
jar: integration-service/target/integration-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9210
|
||||
event-bridge-service:
|
||||
artifactId: event-bridge-service
|
||||
jar: event-bridge-service/target/event-bridge-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9300
|
||||
audit-service:
|
||||
artifactId: audit-service
|
||||
jar: audit-service/target/audit-service-1.0.0-SNAPSHOT.jar
|
||||
port: 9700
|
||||
Reference in New Issue
Block a user