2025-03-02 23:30:03 +08:00
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM registry.cn-hangzhou.aliyuncs.com/newbe36524/aspnet:8.0 AS base
2025-07-17 00:19:53 +08:00
USER root
#定义时区参数
2025-03-02 23:30:03 +08:00
ENV TZ = Asia/Shanghai
2025-07-17 00:19:53 +08:00
#设置编码
ENV LANG C.UTF-8
2025-03-02 23:30:03 +08:00
WORKDIR /app
EXPOSE 19901
EXPOSE 443
FROM registry.cn-hangzhou.aliyuncs.com/newbe36524/sdk:8.0 AS build
ARG BUILD_CONFIGURATION = Release
WORKDIR /src
COPY [ "BZPT.Api/BZPT.Api.csproj" , "BZPT.Api/" ]
COPY [ "BZPT.Domains/BZPT.Domains.csproj" , "BZPT.Domains/" ]
COPY [ "BZPT.DTO/BZPT.DTO.csproj" , "BZPT.DTO/" ]
COPY [ "BZPT.SqlSugarRepository/BZPT.SqlSugarRepository.csproj" , "BZPT.SqlSugarRepository/" ]
RUN dotnet restore "BZPT.Api/BZPT.Api.csproj"
COPY . .
WORKDIR "/src/BZPT.Api"
2025-07-17 00:19:53 +08:00
2025-03-02 23:30:03 +08:00
RUN dotnet build "BZPT.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
WORKDIR "/src/BZPT.Api"
RUN dotnet publish "BZPT.Api.csproj" -c Release -o /app/publish /p:UseAppHost= false
FROM base AS final
WORKDIR /app
COPY --from= publish /app/publish .
2025-07-17 00:19:53 +08:00
#时区设置1
2025-03-02 23:30:03 +08:00
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT [ "dotnet" , "BZPT.Api.dll" ]