Files
DocprintService/docker/Dockerfile
T
2026-09-02 14:14:03 +08:00

27 lines
1.4 KiB
Docker
Raw 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.
# 由 projman 注入的 .NET 运行镜像(单阶段,publish 产物已由 CI 预构建)
# CI 已在 dotnet sdk 容器(--network infra-infra-net,容器名 nexus 直连拉 NuGet 包)
# dotnet publish 到 publish/,并按产物 *.deps.json 生成 entrypoint.sh(无须硬编码项目名)
# 构建上下文 = 仓库根:docker build -f docker/Dockerfile .
# DOTNET_VERSION 默认 5.0(平台现有 .NET 应用均为 5.0);版本不合时自备本文件——已写则 projman 尊重不覆盖。
ARG DOTNET_VERSION=5.0
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}
# .NET 5 基础镜像基于 Debian 10(已 EOL),apt 源须切 archive.debian.org 才能装包
# curl 供 projman compose healthcheck(test: CMD curl -f ...)使用;tzdata 设上海时区
RUN sed -i 's|deb.debian.org|archive.debian.org|g; s|security.debian.org|archive.debian.org|g' /etc/apt/sources.list \
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-valid-until \
&& apt-get update \
&& apt-get install -y --no-install-recommends curl tzdata \
&& ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY publish/ /app/
ENV TZ=Asia/Shanghai
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:10003
EXPOSE 10003
ENTRYPOINT ["sh", "/app/entrypoint.sh"]