forked from scottyhardy/docker-remote-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
executable file
·29 lines (23 loc) · 1.06 KB
/
deploy
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
28
29
#!/usr/bin/env bash
# Grab the base image and extract the Ubuntu version
docker pull "ubuntu:${TAG}"
OS_VERSION="$(docker run -it --rm "ubuntu:${TAG}" /bin/bash -c "grep VERSION_ID= /etc/os-release | cut -d= -f2 | sed -E 's/\"//g'" | tr -d "\r")"
if [ -n "${OS_VERSION}" ]; then
echo "Found Ubuntu version '${OS_VERSION}'"
else
echo "ERROR: Unable to determine Ubuntu version"
exit 1
fi
# Generate tags
docker tag "${DOCKER_REPO}:ubuntu-${TAG}" "${DOCKER_USERNAME}/${DOCKER_REPO}:ubuntu-${TAG}"
docker tag "${DOCKER_REPO}:ubuntu-${TAG}" "${DOCKER_USERNAME}/${DOCKER_REPO}:ubuntu-${OS_VERSION}"
# Login to Docker Hub
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
# Push the image and tags
docker push "${DOCKER_USERNAME}/${DOCKER_REPO}:ubuntu-${TAG}"
docker push "${DOCKER_USERNAME}/${DOCKER_REPO}:ubuntu-${OS_VERSION}"
# Push ubuntu-groovy as latest
if [ "${TAG}" == "groovy" ]; then
docker tag "${DOCKER_REPO}:ubuntu-${TAG}" "${DOCKER_USERNAME}/${DOCKER_REPO}:latest"
docker push "${DOCKER_USERNAME}/${DOCKER_REPO}:latest"
fi