diff --git a/StandAlone.NETCoreApp/Dockerfile.windows-2019 b/StandAlone.NETCoreApp/Dockerfile.windows-2019 new file mode 100644 index 0000000..4a5b4dd --- /dev/null +++ b/StandAlone.NETCoreApp/Dockerfile.windows-2019 @@ -0,0 +1,20 @@ +FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env + +LABEL maintainer="Stef Heyenrath" + +WORKDIR /app + +# copy csproj and restore as distinct layers +COPY StandAlone.NETCoreApp.csproj ./ +RUN dotnet restore + +# copy everything else and build +COPY *.cs ./ +RUN dotnet publish -c Release -o out + +# build runtime image +FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 +WORKDIR /app +COPY --from=build-env /app/out ./ +EXPOSE 80 +ENTRYPOINT ["dotnet", "wiremock-net.dll", "--Urls", "http://*:80", "--ReadStaticMappings", "false"] \ No newline at end of file diff --git a/WireMock.Net Docker Solution.sln b/WireMock.Net Docker Solution.sln index 512896b..bf6829b 100644 --- a/WireMock.Net Docker Solution.sln +++ b/WireMock.Net Docker Solution.sln @@ -7,6 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StandAlone.NETCoreApp", "St EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5AC62511-0096-4DE2-A53D-A899F8F5FD4A}" ProjectSection(SolutionItems) = preProject + azure-pipelines-windows-2019.yml = azure-pipelines-windows-2019.yml azure-pipelines.nano.yml = azure-pipelines.nano.yml azure-pipelines.yml = azure-pipelines.yml GitHubReleaseNotes.txt = GitHubReleaseNotes.txt diff --git a/azure-pipelines-windows-2019.yml b/azure-pipelines-windows-2019.yml new file mode 100644 index 0000000..4aa62ea --- /dev/null +++ b/azure-pipelines-windows-2019.yml @@ -0,0 +1,37 @@ +pool: + vmImage: 'win1803' + +variables: + buildConfiguration: 'Release' + imageName: 'wiremock.net-windows-2019' + buildProjects: '**/StandAlone.NETCoreApp.csproj' + tag: '1.0.16' + +steps: +# Build StandAlone.NETCoreApp +- task: DotNetCoreCLI@2 + displayName: Build StandAlone.NETCoreApp + inputs: + command: 'build' + arguments: /p:Configuration=$(buildConfiguration) + projects: $(buildProjects) + +# Docker +- script: docker build -t $(DOCKER_ID)/$(imageName) -f ./StandAlone.NETCoreApp/Dockerfile.windows-2019 ./StandAlone.NETCoreApp + displayName: 'Build Docker image [$(imageName):latest]' + +- script: docker tag $(DOCKER_ID)/$(imageName):latest $(DOCKER_ID)/$(imageName):$(tag) + displayName: 'Tag Docker image [$(imageName):$(tag)]' + + +# for vs2017-win2016 only ! +# https://stackoverflow.com/questions/51489359/docker-using-password-via-the-cli-is-insecure-use-password-stdin +# https://github.com/Microsoft/azure-pipelines-tasks/issues/6480#issuecomment-453765536 +# echo | set /p="$(DOCKER_PWD)" | docker login --username $(DOCKER_ID) --password-stdin + +# For win1803 ; just use --password +- script: | + docker login --username $(DOCKER_ID) --password $(DOCKER_PWD) + docker push $(DOCKER_ID)/$(imageName):latest + docker push $(DOCKER_ID)/$(imageName):$(tag) + displayName: 'Push Docker image [$(imageName)(latest,$(tag)]' \ No newline at end of file