diff --git a/Dockerfile b/Dockerfile index d913c93..787df90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,15 @@ FROM muccg/python-base:debian8-2.7 MAINTAINER https://github.com/muccg -RUN pip install \ - "devpi-client>=2.0.4,<2.1" \ - "devpi-server>=2.1.3,<2.2" \ - "requests>=2.5.0,<2.6" +ARG DEVPI_VERSION +ARG PIP_INDEX_URL=https://pypi.python.org/simple/ +ARG PIP_TRUSTED_HOST=127.0.0.1 + +ENV DEVPI_VERSION $DEVPI_VERSION + +RUN NO_PROXY=$PIP_TRUSTED_HOST pip --trusted-host $PIP_TRUSTED_HOST install -i $PIP_INDEX_URL --upgrade \ + "devpi-client>=2.3.0,<2.4" \ + "devpi-server==$DEVPI_VERSION" EXPOSE 3141 VOLUME /data diff --git a/build.sh b/build.sh index bd2fa21..6a0f2ac 100755 --- a/build.sh +++ b/build.sh @@ -9,19 +9,28 @@ set -e REPO="muccg" DATE=`date +%Y.%m.%d` -image="${REPO}/devpi:latest" +DEVPI_VERSION="2.5.3" + +# ALternative config to use local proxy +#DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') +#HTTP_PROXY="http://${DOCKER_HOST}:3128" +#PIP_INDEX_URL="http://${DOCKER_HOST}:3141/root/pypi/+simple/" +#PIP_TRUSTED_HOST=${DOCKER_HOST} +#: ${DOCKER_BUILD_OPTIONS:="--no-cache --pull=true --build-arg PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST} --build-arg PIP_INDEX_URL=${PIP_INDEX_URL} --build-arg DEVPI_VERSION=${DEVPI_VERSION}"} + +: ${DOCKER_BUILD_OPTIONS:="--pull=true --build-arg DEVPI_VERSION=${DEVPI_VERSION}"} + +image="${REPO}/devpi" echo "################################################################### ${image}" ## warm up cache for CI docker pull ${image} || true -## build -docker build --pull=true -t ${image}-${DATE} . -docker build -t ${image} . - -## for logging in CI -docker inspect ${image}-${DATE} - -# push -docker push ${image}-${DATE} -docker push ${image} +for tag in "${image}:latest" "${image}:latest-${DATE}" "${image}:${DEVPI_VERSION}"; do + echo "############################################################# ${tag}" + set -x + docker build ${DOCKER_BUILD_OPTIONS} -t ${tag} . + docker inspect ${tag} + docker push ${tag} + set +x +done