- newgrp docker << EONG
- docker pull wurstmeister/kafka
- docker pull wurstmeister/zookeeper
- docker pull mongo
- docker pull mysql:5
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/MON
- docker build ${LWTEMPDIR}/MON -f ${LWTEMPDIR}/MON/docker/Dockerfile -t osm/mon || ! echo "cannot build MON docker image" >&2
- docker build ${LWTEMPDIR}/MON/policy_module -f ${LWTEMPDIR}/MON/policy_module/Dockerfile -t osm/pm || ! echo "cannot build PM docker image" >&2
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NBI
- docker build ${LWTEMPDIR}/NBI -f ${LWTEMPDIR}/NBI/Dockerfile.local -t osm/nbi || ! echo "cannot build NBI docker image" >&2
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO
- docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/docker/Dockerfile-local -t osm/ro || ! echo "cannot build RO docker image" >&2
- docker build ${LWTEMPDIR}/RO/lcm -t osm/lcm || ! echo "cannot build LCM docker image" >&2
- git -C ${LWTEMPDIR} clone https://github.com/superfluidity/osm-light-ui.git
- docker build ${LWTEMPDIR}/osm-light-ui -t osm/light-ui -f ${LWTEMPDIR}/osm-light-ui/code/docker/Dockerfile
-# git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
-# docker build ${LWTEMPDIR}/LW-UI -t osm/light-ui -f ${LWTEMPDIR}/LW-UI/Dockerfile
-EONG
+ _build_from=$COMMIT_ID
+ [ -z "$_build_from" ] && _build_from="master"
+
+ echo "OSM Docker images generated from $_build_from"
+
+ BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY")
+ BUILD_ARGS+=(--build-arg RELEASE="$RELEASE")
+ BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY")
+ BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE")
+
+ if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q KAFKA ; then
+ sg docker -c "docker pull wurstmeister/zookeeper" || FATAL "cannot get zookeeper docker image"
+ sg docker -c "docker pull wurstmeister/kafka:${KAFKA_TAG}" || FATAL "cannot get kafka docker image"
+ fi
+
+ if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MONGO ; then
+ sg docker -c "docker pull mongo" || FATAL "cannot get mongo docker image"
+ fi
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/mon:${OSM_DOCKER_TAG}" || FATAL "cannot pull MON docker image"
+ sg docker -c "docker pull ${DOCKER_USER}/pol:${OSM_DOCKER_TAG}" || FATAL "cannot pull POL docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MON ; then
+ git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/MON
+ git -C ${LWTEMPDIR}/MON checkout ${COMMIT_ID}
+ sg docker -c "docker build ${LWTEMPDIR}/MON -f ${LWTEMPDIR}/MON/docker/Dockerfile -t osm/mon --no-cache" || FATAL "cannot build MON docker image"
+ sg docker -c "docker build ${LWTEMPDIR}/MON/policy_module -f ${LWTEMPDIR}/MON/policy_module/Dockerfile -t osm/pm --no-cache" || FATAL "cannot build PM docker image"
+ fi
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/nbi:${OSM_DOCKER_TAG}" || FATAL "cannot pull NBI docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NBI ; then
+ git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NBI
+ git -C ${LWTEMPDIR}/NBI checkout ${COMMIT_ID}
+ sg docker -c "docker build ${LWTEMPDIR}/NBI -f ${LWTEMPDIR}/NBI/Dockerfile.local -t osm/nbi --no-cache" || FATAL "cannot build NBI docker image"
+ fi
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/ro:${OSM_DOCKER_TAG}" || FATAL "cannot pull RO docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q RO ; then
+ sg docker -c "docker pull mysql:5" || FATAL "cannot get mysql docker image"
+ git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO
+ git -C ${LWTEMPDIR}/RO checkout ${COMMIT_ID}
+ sg docker -c "docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/docker/Dockerfile-local -t osm/ro --no-cache" || FATAL "cannot build RO docker image"
+ fi
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/lcm:${OSM_DOCKER_TAG}" || FATAL "cannot pull LCM RO docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LCM ; then
+ git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LCM
+ git -C ${LWTEMPDIR}/LCM checkout ${COMMIT_ID}
+ sg docker -c "docker build ${LWTEMPDIR}/LCM -f ${LWTEMPDIR}/LCM/Dockerfile.local -t osm/lcm --no-cache" || FATAL "cannot build LCM docker image"
+ fi
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull light-ui docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
+ git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
+ git -C ${LWTEMPDIR}/LW-UI checkout ${COMMIT_ID}
+ sg docker -c "docker build ${LWTEMPDIR}/LW-UI -t osm/light-ui -f ${LWTEMPDIR}/LW-UI/Dockerfile --no-cache" || FATAL "cannot build LW-UI docker image"
+ fi
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}" || FATAL "cannot pull osmclient docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-osmclient; then
+ sg docker -c "docker build -t osm/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ."
+ fi