-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
40 lines (26 loc) · 860 Bytes
/
dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /work
COPY ./Directory.Build.props ./
COPY ./src/*/*.csproj ./
RUN for projectFile in $(ls *.csproj); \
do \
mkdir -p ${projectFile%.*}/ && mv $projectFile ${projectFile%.*}/; \
done
ENV DOTNET_NOLOGO=true
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
RUN dotnet restore /work/Hotel.Api/Hotel.Api.csproj
COPY src .
FROM build AS publish
WORKDIR /work/Hotel.Api
ENV DOTNET_NOLOGO=true
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
RUN dotnet publish -c Release -o /app --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS final
WORKDIR /app
COPY --from=publish /app .
ENV DOTNET_NOLOGO=true
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
HEALTHCHECK --interval=5m --timeout=3s --start-period=10s --retries=1 \
CMD curl --fail http://localhost:80/health || exit 1
EXPOSE 80
ENTRYPOINT ["dotnet", "Hotel.Api.dll"]