更新docker文件

This commit is contained in:
2248356998 qq.com
2025-07-02 07:32:23 +08:00
parent 74a47a1983
commit 298a1f2ed4
3 changed files with 22 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ EXPOSE 5000
# 添加时区环境变量,亚洲,上海
ENV TimeZone=Asia/Shanghai
# 转发头
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
# 使用软连接,并且将时区配置覆盖/etc/timezone
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone

View File

@@ -13,6 +13,8 @@ EXPOSE 5000
# 添加时区环境变量,亚洲,上海
ENV TimeZone=Asia/Shanghai
# 转发头
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
# 使用软连接,并且将时区配置覆盖/etc/timezone
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone

View File

@@ -0,0 +1,18 @@
version: "latest" # Docker Compose 配置版本
services: # 定义所有要跑的容器(服务)
thingsgateway: #服务名称
image: registry.cn-shenzhen.aliyuncs.com/thingsgateway/thingsgateway:latest #镜像名:tag
container_name: thingsgateway #容器名字
ports:
- "127.0.0.1:5000:5000" #"主机端口:容器端口"
environment:
- ASPNETCORE_ENVIRONMENT=Demo #环境变量名=值
volumes: #挂载本机目录
- /thingsgateway/Keys:/app/Keys
- /thingsgateway/DB:/app/DB
deploy:
resources:
limits:
memory: 512M
restart: always # 容器异常退出自动重启