- 新增docker/tinode/Dockerfile.build:从本仓库源码编译server/tinode-db/ apply_hotgo_tenant_db,替代原Dockerfile下载GitHub release的方式(否则 workbench/组织架构/会议等改造代码永远不会真正跑起来) - config.template补上连接池设置(max_open_conns等,此前im_server踩过注册卡死 的坑),并启用tenant_db_routing+tenant_registry_db=hotgo,对应本仓库自带 tinode.conf里的默认约定,单租户场景下会透明落回同一个tinode库 - entrypoint.sh在init-db之后追加执行apply-hotgo-tenant-db,幂等地建好/ 升级hotgo租户注册表及tinode库里的workbench/组织架构/会议/日报/信箱等新表 - 新增.gitea/workflows/deploy.yml,复用服务器上已有的蓝绿部署脚本
84 lines
2.7 KiB
INI
84 lines
2.7 KiB
INI
# Builds the Tinode server + tinode-db + tenant-db-migration tools from THIS
|
|
# repo's local source, instead of downloading a pre-built release from GitHub
|
|
# (the upstream docker/tinode/Dockerfile does that, so it never picks up the
|
|
# tenant/workbench/etc. customizations that live only in this repo's source).
|
|
|
|
# ---- Stage 1: compile from local source ----
|
|
FROM golang:1.26-alpine AS build
|
|
|
|
RUN apk add --no-cache git
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -tags mysql -o /out/tinode ./server
|
|
RUN CGO_ENABLED=0 go build -tags mysql -o /out/init-db ./tinode-db
|
|
# scripts/apply_hotgo_tenant_db.go is `//go:build ignore`-tagged (a standalone
|
|
# migration script, not part of any package) - build it by exact file path.
|
|
RUN CGO_ENABLED=0 go build -o /out/apply-hotgo-tenant-db ./scripts/apply_hotgo_tenant_db.go
|
|
|
|
# ---- Stage 2: runtime image ----
|
|
FROM alpine:3.22
|
|
|
|
LABEL maintainer="118im"
|
|
LABEL name="ImServer"
|
|
|
|
# Runtime options (same names/semantics as upstream docker/tinode/Dockerfile).
|
|
ENV WAIT_FOR=
|
|
ENV RESET_DB=false
|
|
ENV UPGRADE_DB=false
|
|
ENV NO_DB_INIT=false
|
|
# Empty by default: do not load Tinode's canned demo users into a real deployment.
|
|
# Override explicitly if sample data is ever wanted.
|
|
ENV SAMPLE_DATA=
|
|
ENV DEFAULT_COUNTRY_CODE=US
|
|
|
|
# DB connection is provided at deploy time via secret-backed env var. No default value.
|
|
ENV MYSQL_DSN=
|
|
ENV STORE_USE_ADAPTER=mysql
|
|
|
|
# Tenant registry lives in the hotgo database (shared with im_manager); tenant
|
|
# DB routing resolves to the same tinode DB for the seeded "default" tenant.
|
|
ENV TENANT_REGISTRY_DB=hotgo
|
|
|
|
ENV MEDIA_HANDLER=fs
|
|
ENV FS_CORS_ORIGINS='["*"]'
|
|
ENV AWS_CORS_ORIGINS='["*"]'
|
|
ENV SMTP_HOST_URL='http://localhost:6060'
|
|
ENV TLS_ENABLED=false
|
|
ENV FCM_PUSH_ENABLED=false
|
|
ENV FCM_INCLUDE_ANDROID_NOTIFICATION=true
|
|
ENV TNPG_PUSH_ENABLED=false
|
|
ENV WEBRTC_ENABLED=false
|
|
ENV SERVER_STATUS_PATH=''
|
|
ENV ACC_GC_ENABLED=false
|
|
ENV PLUGIN_PYTHON_CHAT_BOT_ENABLED=false
|
|
|
|
# Secrets: intentionally NO default values. Must be injected at deploy time.
|
|
# An empty/missing value fails loudly at startup rather than silently falling
|
|
# back to Tinode's publicly-known demo keys.
|
|
ENV API_KEY_SALT=
|
|
ENV AUTH_TOKEN_KEY=
|
|
ENV UID_ENCRYPTION_KEY=
|
|
|
|
RUN apk add --no-cache ca-certificates bash grep
|
|
|
|
WORKDIR /opt/tinode
|
|
|
|
COPY docker/tinode/config.template .
|
|
COPY docker/tinode/entrypoint.sh .
|
|
COPY tinode-db/credentials.sh .
|
|
COPY --from=build /out/tinode .
|
|
COPY --from=build /out/init-db .
|
|
COPY --from=build /out/apply-hotgo-tenant-db .
|
|
|
|
RUN mkdir -p /botdata static \
|
|
&& chmod +x entrypoint.sh credentials.sh tinode init-db apply-hotgo-tenant-db
|
|
|
|
HEALTHCHECK --interval=1m --timeout=3s --start-period=30s \
|
|
CMD nc -z localhost 6060 || exit 1
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|
|
|
|
EXPOSE 6060 16060
|