-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (39 loc) · 1.54 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
ARG GIT_VERSION_TAG
ARG GIT_COMMIT_MESSAGE=unspecified
ARG GIT_VERSION_HASH=unspecified
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
ENV TZ="Europe/London"
ENV ASPNETCORE_HTTP_PORTS=8880
EXPOSE $ASPNETCORE_HTTP_PORTS
ENV LOG_FOLDER=/logs
ENV LOG_LEVEL=Information
ENV CONFIG_PATH=/app/config
ENV Serilog__MinimumLevel=$LOG_LEVEL
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/Proxarr.Api/Proxarr.Api.csproj", "Proxarr.Api/"]
RUN dotnet restore "./Proxarr.Api/Proxarr.Api.csproj"
COPY ./src .
WORKDIR "/src/Proxarr.Api"
RUN dotnet build "./Proxarr.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Proxarr.Api.csproj" -c $BUILD_CONFIGURATION -p:Version=${GIT_VERSION_TAG:-1.0.0} -o /app/publish /p:UseAppHost=false
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
VOLUME ${LOG_FOLDER}/
VOLUME ${CONFIG_PATH}/
COPY --from=publish /app/publish .
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
USER $APP_UID
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD curl -f http://localhost:$ASPNETCORE_HTTP_PORTS/health || exit 1
ENTRYPOINT ["dotnet", "Proxarr.Api.dll"]