kt-template-online-api/dockerfile

54 lines
2.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM node:22-bookworm-slim
WORKDIR /app
ENV NODE_ENV=production
ENV TZ=Asia/Shanghai
ENV APP_PORT=48085
ENV LOG_LEVEL=info
ENV LOG_APP_NAME=kt-template-online-api
ENV LOG_PRETTY=false
ENV LOKI_ENV=production
ENV LOKI_PUSH_ENDPOINT=/loki/api/v1/push
ENV LOKI_QUERY_ENDPOINT=/loki/api/v1/query_range
ENV LOKI_PUSH_TIMEOUT_MS=30000
ENV LOKI_QUERY_TIMEOUT_MS=10000
ENV LOKI_BATCH_INTERVAL_SECONDS=5
ENV LOKI_BATCH_MAX_BUFFER_SIZE=10000
ENV LOKI_QUERY_MAX_LIMIT=1000
ENV LOKI_SILENCE_ERRORS=true
ENV FFLOGS_BASE_URL=https://cn.fflogs.com
ENV FFLOGS_WEB_BASE_URL=https://cn.fflogs.com
ENV FFLOGS_GRAPHQL_URL=https://cn.fflogs.com/api/v2/client
ENV FFLOGS_TOKEN_URL=https://cn.fflogs.com/oauth/token
ENV FFLOGS_DEFAULT_SERVER_REGION=CN
ENV FFLOGS_REQUEST_TIMEOUT_MS=10000
# skia-canvas uses binary.module_name=index, so node-pre-gyp reads this mirror key.
ENV npm_config_index_binary_host_mirror=https://registry.npmmirror.com/-/binary/skia-canvas/
COPY package.json pnpm-lock.yaml ./
RUN sed -i \
-e 's#http://deb.debian.org/debian-security#http://mirrors.aliyun.com/debian-security#g' \
-e 's#http://security.debian.org/debian-security#http://mirrors.aliyun.com/debian-security#g' \
-e 's#http://deb.debian.org/debian#http://mirrors.aliyun.com/debian#g' \
/etc/apt/sources.list.d/debian.sources \
&& apt-get update -o Acquire::Retries=5 \
&& apt-get install -y --no-install-recommends fontconfig fonts-noto-cjk openssh-client \
&& fc-cache -f \
&& rm -rf /var/lib/apt/lists/*
# 生产镜像只安装运行依赖dist 由 Jenkins Build stage 提前产出。
# 跳过安装阶段脚本,避免 NODE_ENV=production 时 devDependency 中的 husky 不存在导致 prepare 失败。
RUN npm install -g pnpm@9.15.9 --registry=https://registry.npmmirror.com \
&& pnpm config set registry https://registry.npmmirror.com \
&& pnpm install --prod --frozen-lockfile --ignore-scripts \
&& pnpm rebuild skia-canvas
# dist 由 Jenkins 的 Build stage 生成,这里只打包运行产物。
COPY dist ./dist
EXPOSE 48085
CMD ["node", "dist/main"]