diff --git a/New_College.Api/Dockerfile b/New_College.Api/Dockerfile index 2aa9f96..01e616e 100644 --- a/New_College.Api/Dockerfile +++ b/New_College.Api/Dockerfile @@ -1,7 +1,12 @@ +# 使用 SDK 镜像作为构建基础 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build -RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -RUN echo 'Asia/Shanghai' >/etc/timezone +ENV TZ=Asia/Shanghai +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +# 设置工作目录 WORKDIR /app -COPY --from=build /app ./ + +# 暴露应用端口 EXPOSE 8081 +COPY . . +# 设置容器启动命令 ENTRYPOINT ["dotnet", "New_College.Api.dll","-b","0.0.0.0"]