From 2cb896b08c560ed8de1b5f14f4a3fbd54fec737c Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Fri, 12 Nov 2021 19:12:40 +0200 Subject: [PATCH] build and release scripts --- IdentityServer.sln | 11 +++++++++-- build-amd64.sh | 22 ++++++++++++++++++++++ release.sh | 22 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 build-amd64.sh create mode 100644 release.sh diff --git a/IdentityServer.sln b/IdentityServer.sln index ff2fe53..b545039 100644 --- a/IdentityServer.sln +++ b/IdentityServer.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30717.126 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5A8FF505-3E4D-4258-BC3E-CACD74A7B98C}" EndProject @@ -30,6 +30,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer.PublishedLan EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer.Wrapper", "IdentityServer.Wrapper\IdentityServer.Wrapper.csproj", "{F6FEC33B-C79E-4484-B356-9C7F1A5E5D95}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{5A9268B6-F73B-4773-86BF-45DFF7EF75F7}" + ProjectSection(SolutionItems) = preProject + build-amd64.sh = build-amd64.sh + release.sh = release.sh + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,6 +77,7 @@ Global {CE81A435-49AC-4544-A381-FAC91BEB3C49} = {5A8FF505-3E4D-4258-BC3E-CACD74A7B98C} {67B4D1FF-D02E-4DA6-9FB8-F71667360448} = {5A8FF505-3E4D-4258-BC3E-CACD74A7B98C} {F6FEC33B-C79E-4484-B356-9C7F1A5E5D95} = {5A8FF505-3E4D-4258-BC3E-CACD74A7B98C} + {5A9268B6-F73B-4773-86BF-45DFF7EF75F7} = {0B8B6E9B-0200-47EC-91D9-BEDF4BFC248F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E93DC46D-9C55-4A05-B299-497CDD90747E} diff --git a/build-amd64.sh b/build-amd64.sh new file mode 100644 index 0000000..f35e4a4 --- /dev/null +++ b/build-amd64.sh @@ -0,0 +1,22 @@ +#!/bin/bash +echo "Welcome!" + +version="1.0.0" +localRegistryPass="***REMOVED***" + +echo "Create docker image with version $version." +docker image build -t "identity-server:$version" -f "IdentityServer.Api/Dockerfile" . + +echo "Tag docker image with registry prefix." +docker tag identity-server:$version alpine-nexus:8500/identity/identity-server:$version + +echo "Login to alpine-nexus registry." +docker login --username=admin --password=$localRegistryPass alpine-nexus:8500 + +echo "Push image alpine-nexus:8500/identity/identity-server:$version to registry." +docker push alpine-nexus:8500/identity/identity-server:$version + +echo "Remove image alpine-nexus:8500/identity/identity-server:$version from local machine." +docker rmi alpine-nexus:8500/identity/identity-server:$version + +echo "DONE!" \ No newline at end of file diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..5014cda --- /dev/null +++ b/release.sh @@ -0,0 +1,22 @@ +#!/bin/sh +echo "Welcome!" + +version="1.0.0" +oldver="1.0.0" + +echo "Pull docker image identity-server:$version from registry." +docker pull alpine-nexus:8500/identity/identity-server:$version + +echo "Stop old container." +docker stop identity-server && docker rm identity-server + +echo "Run new container." +docker run -d --name identity-server --restart=always -p 5011:80 alpine-nexus:8500/identity/identity-server:$version + +echo "Remove old image identity-server:$oldver." +docker rmi alpine-nexus:8500/identity/identity-server:$oldver + +echo "Get container logs:" +docker logs identity-server + +echo "DONE!" \ No newline at end of file