-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (25 loc) · 748 Bytes
/
Copy pathDockerfile
File metadata and controls
30 lines (25 loc) · 748 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
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-noble-chiseled AS base
USER $APP_UID
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /build
COPY src src
COPY test test
COPY *.sln .
COPY global.json .
RUN dotnet restore
RUN dotnet build
ARG TESTS_ENABLE=1
RUN \[ ${TESTS_ENABLE} -ne 1 \] \
|| \
([ -d "test" \] \
&& dotnet test )
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN rm -rf test *sln global.json \
&& dotnet publish "src/RedShirt.Example.JobWorker/RedShirt.Example.JobWorker.csproj" --self-contained -c $BUILD_CONFIGURATION -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["./RedShirt.Example.JobWorker"]