Skip to content

Instantly share code, notes, and snippets.

@nixel2007
Created October 30, 2020 13:23
Show Gist options
  • Save nixel2007/e245a1627e4626cc8f309e5ae6a71b71 to your computer and use it in GitHub Desktop.
Save nixel2007/e245a1627e4626cc8f309e5ae6a71b71 to your computer and use it in GitHub Desktop.
#!/bin/bash
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_USERNAME
if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
fi
last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
last_arg='--no-cache .'
fi
if [ $BUILD_BASE_JENKINS_AGENT = 'true' ] ; then
docker build \
--pull \
--build-arg ONEC_USERNAME=$ONEC_USERNAME \
--build-arg ONEC_PASSWORD=$ONEC_PASSWORD \
--build-arg ONEC_VERSION=$ONEC_VERSION \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
-t $DOCKER_USERNAME/onec-client:$ONEC_VERSION \
-f client/Dockerfile \
$last_arg
docker push $DOCKER_USERNAME/onec-client:$ONEC_VERSION
docker build \
--pull \
--build-arg ONEC_USERNAME=$ONEC_USERNAME \
--build-arg ONEC_PASSWORD=$ONEC_PASSWORD \
--build-arg ONEC_VERSION=$ONEC_VERSION \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
-t $DOCKER_USERNAME/onec-client-vnc:$ONEC_VERSION \
-f client-vnc/Dockerfile \
$last_arg
docker push $DOCKER_USERNAME/onec-client-vnc:$ONEC_VERSION
docker build \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
--build-arg BASE_IMAGE=onec-client-vnc \
--build-arg BASE_TAG=$ONEC_VERSION \
-t $DOCKER_USERNAME/onec-client-vnc-oscript:$ONEC_VERSION \
-f oscript/Dockerfile \
$last_arg
docker build \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
--build-arg BASE_IMAGE=onec-client-vnc-oscript \
--build-arg BASE_TAG=$ONEC_VERSION \
-t $DOCKER_USERNAME/onec-client-vnc-oscript-jdk:$ONEC_VERSION \
-f jdk/Dockerfile \
$last_arg
docker build \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
--build-arg BASE_IMAGE=onec-client-vnc-oscript-jdk \
--build-arg BASE_TAG=$ONEC_VERSION \
-t $DOCKER_USERNAME/onec-client-vnc-oscript-jdk-testutils:$ONEC_VERSION \
-f test-utils/Dockerfile \
$last_arg
docker build \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
--build-arg BASE_IMAGE=onec-client-vnc-oscript-jdk-testutils \
--build-arg BASE_TAG=$ONEC_VERSION \
-t $DOCKER_USERNAME/base-jenkins-agent:$ONEC_VERSION \
-f jenkins-agent/Dockerfile \
$last_arg
docker push $DOCKER_USERNAME/base-jenkins-agent:$ONEC_VERSION
fi
if [ $BUILD_CRS = 'true' ] ; then
docker build \
--pull \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
--build-arg ONEC_USERNAME=$ONEC_USERNAME \
--build-arg ONEC_PASSWORD=$ONEC_PASSWORD \
--build-arg ONEC_VERSION=$ONEC_VERSION \
-t $DOCKER_USERNAME/crs:$ONEC_VERSION \
-f crs/Dockerfile \
$last_arg
docker push $DOCKER_USERNAME/crs:$ONEC_VERSION
docker build \
--build-arg DOCKER_USERNAME=$DOCKER_USERNAME \
--build-arg ONEC_VERSION=$ONEC_VERSION \
-t $DOCKER_USERNAME/crs-apache:$ONEC_VERSION \
-f crs-apache/Dockerfile \
$last_arg
docker push $DOCKER_USERNAME/crs-apache:$ONEC_VERSION
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment