-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (20 loc) · 805 Bytes
/
Dockerfile
File metadata and controls
27 lines (20 loc) · 805 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
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.sln .
COPY src/Timecop.Core/Timecop.Core.csproj ./src/Timecop.Core/Timecop.Core.csproj
COPY test/Timecop.Core.Tests/Timecop.Core.Tests.csproj ./test/Timecop.Core.Tests/Timecop.Core.Tests.csproj
RUN dotnet restore
# copy everything else and build app
COPY ./ ./
WORKDIR /source
RUN dotnet build -c release -o /out/package --no-restore
FROM build as test
ENV TZ="Africa/Johannesburg"
RUN dotnet test
FROM build as pack-and-push
WORKDIR /source
ARG PackageVersion
ARG NuGetApiKey
RUN dotnet pack ./src/Timecop.Core/Timecop.Core.csproj -o /out/package -c Release
RUN dotnet nuget push /out/package/Timecop.Core.$PackageVersion.nupkg -k $NuGetApiKey -s https://api.nuget.org/v3/index.json