37 lines
1.2 KiB
Docker
37 lines
1.2 KiB
Docker
#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
|
|
USER root
|
|
#定义时区参数
|
|
ENV TZ=Asia/Shanghai
|
|
#设置编码
|
|
ENV LANG C.UTF-8
|
|
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"
|
|
|
|
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 .
|
|
|
|
#时区设置1
|
|
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
|
|
|
ENTRYPOINT ["dotnet", "BZPT.Api.dll"] |