容器化配置

This commit is contained in:
05412 2024-07-23 17:54:15 +08:00
parent cded56a768
commit b4c2cec043
4 changed files with 43 additions and 2 deletions

5
Dockerfile Normal file
View File

@ -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"]

View File

@ -8,6 +8,9 @@
### 环境变量
- `PROTOCOL`: 外链协议
- `HOST`: 主机
- `PORT`: 端口
- `DB_HOST`: 数据库主机, 必选
- `DB_PORT`: 数据库主机端口, 可选
- `DB_PASS`: 数据库密码, 必选

33
docker-compose.yml Normal file
View File

@ -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"

View File

@ -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:} # 密钥