From d0778e0c524f697945229019e07c919aa7aead19 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sat, 14 May 2022 19:56:46 +0300 Subject: [PATCH] added build and release scripts --- build.sh | 19 +++++++++++++++++++ release.sh | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 build.sh create mode 100644 release.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..f1a308b --- /dev/null +++ b/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash +echo "Welcome!" + +version="1.2.0" +registryPass="***REMOVED***" + +echo "Create docker image with version $version." +docker image build -t "reverse-proxy-frontend:$version" . + +echo "Tag docker image with registry prefix." +docker tag reverse-proxy-frontend:$version alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:$version + +echo "Login to alpine-nexus registry." +docker login --username=admin --password=$registryPass alpine-nexus:8500 + +echo "Push image reverse-proxy-frontend:$version to registry." +docker push alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:$version + +echo "DONE!" \ No newline at end of file diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..28de989 --- /dev/null +++ b/release.sh @@ -0,0 +1,22 @@ +#!/bin/sh +echo "Welcome!" + +version="1.2.0" +oldver="1.0.5" + +echo "Pull docker image reverse-proxy-frontend:$version from registry." +docker pull alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:$version + +echo "Stop old container." +docker stop reverse-proxy-frontend && docker rm reverse-proxy-frontend + +echo "Run new container." +docker run -d --name reverse-proxy-frontend --restart=always -p 5009:80 alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:$version + +echo "Remove old image reverse-proxy-frontend:$oldver." +docker rmi alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:$oldver + +echo "Get container logs:" +docker logs reverse-proxy-frontend + +echo "DONE!" \ No newline at end of file