131 lines
4.4 KiB
INI
131 lines
4.4 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=true
|
|
# 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
|
|
|
|
ENV STORE_USE_ADAPTER=mysql
|
|
ENV REDIS_ADDR=
|
|
ENV REDIS_USERNAME=
|
|
ENV REDIS_DB=0
|
|
ENV REDIS_DIAL_TIMEOUT_MS=2000
|
|
ENV REDIS_READ_TIMEOUT_MS=2000
|
|
ENV REDIS_WRITE_TIMEOUT_MS=2000
|
|
ENV REDIS_PENDING_TTL_SECONDS=120
|
|
ENV REDIS_DONE_TTL_SECONDS=86400
|
|
ENV REDIS_FAILED_TTL_SECONDS=600
|
|
ENV REDIS_HOT_MESSAGE_TTL_SECONDS=86400
|
|
ENV REDIS_PRESENCE_TTL_SECONDS=120
|
|
ENV REDIS_CACHE_TTL_SECONDS=300
|
|
ENV REDIS_SHORT_STATE_TTL_SECONDS=600
|
|
ENV REDIS_GROUP_FANOUT_ENABLED=true
|
|
ENV KAFKA_ENABLED=false
|
|
ENV KAFKA_BROKERS_JSON='[]'
|
|
ENV KAFKA_CLIENT_ID=im-server
|
|
ENV KAFKA_CONSUMER_GROUP=im-server
|
|
ENV KAFKA_DIAL_TIMEOUT_MS=3000
|
|
ENV KAFKA_WRITE_TIMEOUT_MS=3000
|
|
ENV KAFKA_READ_TIMEOUT_MS=3000
|
|
ENV KAFKA_REQUIRED_ACKS=1
|
|
ENV KAFKA_ALLOW_AUTO_TOPIC_CREATION=false
|
|
ENV KAFKA_TLS_ENABLED=false
|
|
ENV KAFKA_SASL_ENABLED=false
|
|
ENV KAFKA_SASL_MECHANISM=SCRAM-SHA-512
|
|
ENV KAFKA_SASL_USERNAME=
|
|
ENV KAFKA_SASL_PASSWORD=
|
|
ENV KAFKA_MAX_RETRY_COUNT=5
|
|
ENV KAFKA_RETRY_BACKOFF_MS='[10000,30000,60000,300000,900000]'
|
|
ENV KAFKA_DEAD_LETTER_RETENTION_SECONDS=7776000
|
|
ENV KAFKA_TOPIC_ADMIN_COMMAND=im.admin.command
|
|
ENV KAFKA_TOPIC_ADMIN_COMMAND_RESULT=im.admin.command.result
|
|
ENV KAFKA_TOPIC_CONFIG_EVENT=im.config.event
|
|
ENV KAFKA_TOPIC_BUSINESS_EVENT=im.business.event
|
|
ENV KAFKA_TOPIC_MESSAGE_PERSIST=im.message.persist
|
|
ENV KAFKA_TOPIC_MESSAGE_PUSH=im.message.push
|
|
ENV KAFKA_TOPIC_FILE_SECURITY=im.file.security
|
|
ENV KAFKA_TOPIC_FILE_LIFECYCLE=im.file.lifecycle
|
|
ENV KAFKA_TOPIC_WORKBENCH_EVENT=im.workbench.event
|
|
ENV KAFKA_TOPIC_CACHE_INVALIDATE=im.cache.invalidate
|
|
ENV KAFKA_TOPIC_AUDIT_EVENT=im.audit.event
|
|
ENV KAFKA_TOPIC_DEAD_LETTER=im.dead.letter
|
|
ENV INTERNAL_API_ENABLED=false
|
|
ENV INTERNAL_API_TIME_WINDOW_SECONDS=300
|
|
ENV INTERNAL_API_HOTGO_SERVICE_NAME=hotgo-admin
|
|
ENV INTERNAL_API_HOTGO_SECRET=
|
|
ENV ADMIN_INTERNAL_API_ENABLED=false
|
|
ENV ADMIN_INTERNAL_API_BASE_URL=
|
|
ENV ADMIN_INTERNAL_API_SERVICE_NAME=im-server
|
|
ENV ADMIN_INTERNAL_API_SECRET=
|
|
ENV ADMIN_INTERNAL_API_TIMEOUT_MS=3000
|
|
|
|
# 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 TEL_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 ICE_SERVERS_FILE=/opt/tinode/ice-servers.json
|
|
ENV SERVER_STATUS_PATH=''
|
|
ENV ACC_GC_ENABLED=false
|
|
ENV PLUGIN_PYTHON_CHAT_BOT_ENABLED=false
|
|
|
|
RUN apk add --no-cache ca-certificates bash grep
|
|
|
|
WORKDIR /opt/tinode
|
|
|
|
COPY docker/tinode/config.template .
|
|
COPY docker/tinode/entrypoint.sh .
|
|
COPY docker/tinode/ice-servers.json .
|
|
COPY tinode-db/credentials.sh .
|
|
COPY server/templ ./templ
|
|
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
|