summaryrefslogtreecommitdiff
path: root/build.sh
blob: 0e8e3c20d5175d8b176b3b81c49b746d862cb806 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
PROJECT=astroconda/python
PYTHON_VERSION="${1}"
if [[ -z ${PYTHON_VERSION} ]]; then
    echo "Need a fully qualified Python version to build. [e.g. 3.7.1]"
    exit 1
fi

BASE_VERSION="${2}"
if [[ -z ${BASE_VERSION} ]]; then
    BASE_VERSION="latest"
fi

is_tag_latest=$([[ -f LATEST ]] && [[ $(<LATEST) == ${PYTHON_VERSION} ]] && echo yes)
if [[ -n ${is_tag_latest} ]]; then
    tag_latest="-t ${PROJECT}:latest"
fi


docker build -t ${PROJECT}:${PYTHON_VERSION} \
    ${tag_latest} \
    --build-arg PYTHON_VERSION=${PYTHON_VERSION} \
    --build_arg BASE_VERSION=${BASE_VERSION} \
    .