build.sh 829 Bytes
Newer Older
Philip ABBET's avatar
Philip ABBET committed
1 2 3 4
#!/usr/bin/env bash

# Default values
PROJECT_REPOSITORY=git@gitlab.idiap.ch:beat/beat.env.python27
Philip ABBET's avatar
Philip ABBET committed
5
PROJECT_BRANCH=v0.1.0
Philip ABBET's avatar
Philip ABBET committed
6
IMAGE_NAME=beat.env.python
Philip ABBET's avatar
Philip ABBET committed
7
IMAGE_TAG=0.1.0
Philip ABBET's avatar
Philip ABBET committed
8 9 10
REGISTRY=docker.idiap.ch/beat

# Customisation from the command-line, used mainly by the CI
11
if [ $# != 0 ]; then
Philip ABBET's avatar
Philip ABBET committed
12 13 14 15 16 17 18 19 20 21
    IFS=:
    read image_fullname IMAGE_TAG <<< "$1"
    REGISTRY=${image_fullname%/*}
    IMAGE_NAME=${image_fullname##*/}
fi

if [ $# == 2 ]; then
    PROJECT_REPOSITORY="https://${2}@gitlab.idiap.ch/${PROJECT_REPOSITORY##*:}"
fi

22 23 24 25
# Build the image (in three steps)
docker build --rm=true -t "${IMAGE_NAME}:${IMAGE_TAG}__pre_build" -f ./Dockerfile_pre_build .
./scripts/build.sh "${PROJECT_REPOSITORY}" $PROJECT_BRANCH $IMAGE_NAME "${IMAGE_TAG}__build"
docker build --rm=true -t "${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" -f ./Dockerfile_post_build .