diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..061d0e6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM amazoncorretto:21 +COPY . /usr/src/surl +WORKDIR /usr/src/surl +RUN chmod 754 ./gradlew && ./gradlew build -x test +CMD ["java", "-jar", "./build/libs/surl-0.0.1-SNAPSHOT.jar"] diff --git a/README.MD b/README.MD index b0e88a6..65dca56 100644 --- a/README.MD +++ b/README.MD @@ -8,6 +8,9 @@ ### 环境变量 +- `PROTOCOL`: 外链协议 +- `HOST`: 主机 +- `PORT`: 端口 - `DB_HOST`: 数据库主机, 必选 - `DB_PORT`: 数据库主机端口, 可选 - `DB_PASS`: 数据库密码, 必选 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d036612 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +version: '3' +networks: + surl-network: + external: true +services: + surl: + image: surl + restart: no + ports: + - "127.0.0.1:1888:1888" + networks: + - surl-network + environment: + PROTOCOL: http + HOST: localhost + PORT: 18888 + DB_HOST: postgres_forsurl + DB_PORT: 5432 +# DB_PASS: PASSWORD4DB + REDIS_HOST: redis_forsurl +# SECRET_KEY: ne09xhakcvoi13$>":<[]. + redis_forsurl: + image: redis:latest + restart: no + networks: + - surl-network + postgres_forsurl: + image: postgres:latest + restart: no + networks: + - surl-network +# environment: +# POSTGRES_PASSWORD: "PASSWORD4DB" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2a66683..53d7157 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 18888 # 端口 + port: ${PORT:18888} # 端口 spring: profiles: active: default # 激活配置 @@ -47,7 +47,7 @@ logging: # 基础配置: dev.surl.surl.cfg.BaseConfig base: configs: - site: http://localhost:${server.port} # 站点 + site: ${PROTOCOL:http}://${HOST:localhost}:${server.port} # 站点 expire: 6 # 过期时间 unit: hours # 单位 secret: ${SECRET_KEY:} # 密钥