-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (31 loc) · 953 Bytes
/
Dockerfile
File metadata and controls
37 lines (31 loc) · 953 Bytes
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
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["API.csproj", "."]
RUN dotnet restore "./API.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "./API.csproj" -c $BUILD_CONFIGURATION -a x64 -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./API.csproj" -c $BUILD_CONFIGURATION -a x64 -o /app/publish /p:UseAppHost=false
FROM base AS final
ENV \
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8
RUN apk add --no-cache \
icu-data-full \
icu-libs
RUN apk add --update \
curl \
&& rm -rf /var/cache/apk/*
WORKDIR /app
COPY --from=publish /app/publish .
RUN chown -R 1000:1000 /app
USER 1000
ENTRYPOINT ["dotnet", "API.dll"]
HEALTHCHECK --interval=60s --retries=5 CMD curl --fail http://localhost/health || exit 1