forked from Soluto/tweek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TweekApiDockerfile
26 lines (22 loc) · 930 Bytes
/
TweekApiDockerfile
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
# ---- *.csproj FILES ----
FROM alpine as csproj-files
COPY . /src
RUN find /src -type f -not -name "*.csproj" -delete
# ---- BUILD & TEST ----
FROM microsoft/aspnetcore-build:2.0.0 as source
WORKDIR /src
COPY --from=csproj-files /src .
COPY ./Tweek.sln .
RUN dotnet restore ./Tweek.sln
COPY . .
RUN dotnet build Tweek.sln -c Release && \
find . -regex '.*\.\(Unit\|Integration\|\)Tests\.csproj' -print0 | xargs -0 -n 1 -P 16 dotnet test -c=Release --no-build && \
dotnet publish ./services/api/Tweek.ApiService.NetCore/Tweek.ApiService.NetCore.csproj -c Release -o ./obj/Docker/publish
# ---- RELEASE ----
FROM microsoft/aspnetcore:2.0.0 as release
WORKDIR /app
EXPOSE 80
COPY --from=source /src/services/api/Tweek.ApiService.NetCore/obj/Docker/publish .
HEALTHCHECK --interval=15s --timeout=15s --retries=8 \
CMD curl -f http://localhost/health || exit 1
ENTRYPOINT ["dotnet", "Tweek.ApiService.NetCore.dll"]