-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.State
32 lines (24 loc) · 1.28 KB
/
Dockerfile.State
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
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS installer-env
# A reddit wizard says copy csproj filtes and do a restore first
# https://www.reddit.com/r/docker/comments/i34thd/dotnet_core_slow_restore/g0azda1?utm_source=share&utm_medium=web2x&context=3
# It does help, we went from 3m20s to build after changes to 1m20s
COPY pact/StateServer/StateServer.csproj ./app/pact/StateServer/
COPY src/Models/Models.csproj ./app/src/Models/
COPY src/Database/Database.csproj ./app/src/Database/
WORKDIR /app
RUN dotnet restore pact/StateServer/StateServer.csproj
# then copy the rest and build/publish.
COPY src ./src/
COPY pact ./pact/
RUN mkdir -p home/site/wwwroot && \
dotnet publish -c Release pact/StateServer/StateServer.csproj --output home/site/wwwroot
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated8.0
WORKDIR /app
ENV AzureWebJobsScriptRoot=/app/home/site/wwwroot
ENV AzureFunctionsJobHost__Logging__Console__IsEnabled=true
ENV AzureWebJobsDisableHomepage=true
ENV DatabaseConnectionString=Server=integration-test-db;Database=ItPeople;User\ Id=SA;Password=abcd1234@;
COPY --from=installer-env ["/app/home/site/wwwroot", "/app/home/site/wwwroot"]
EXPOSE 80
HEALTHCHECK --interval=10s --timeout=1s --retries=60 \
CMD curl --fail http://localhost:80/ping || exit 1