diff --git a/docker/Dockerfile-dev b/docker/Dockerfile-dev index 171d006..2f0937e 100644 --- a/docker/Dockerfile-dev +++ b/docker/Dockerfile-dev @@ -1,14 +1,14 @@ FROM python:3.8-slim as aprsd # Dockerfile for building a container during aprsd development. -ARG BRANCH +ARG branch ARG UID ARG GID ENV APRS_USER=aprs ENV HOME=/home/aprs ENV APRSD=http://github.com/craigerl/aprsd.git -ENV APRSD_BRANCH=${BRANCH:-master} +ENV APRSD_BRANCH=${branch:-master} ENV VIRTUAL_ENV=$HOME/.venv3 ENV UID=${UID:-1000} ENV GID=${GID:-1000} diff --git a/docker/build.sh b/docker/build.sh index 6ab4edf..68f6dbc 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -15,14 +15,18 @@ EOF ALL_PLATFORMS=0 DEV=0 -TAG="master" +TAG="latest" +BRANCH="master" -while getopts “t:da” OPTION +while getopts “t:dab:” OPTION do case $OPTION in t) TAG=$OPTARG ;; + b) + BRANCH=$OPTARG + ;; a) ALL_PLATFORMS=1 ;; @@ -45,20 +49,28 @@ else PLATFORMS="linux/amd64" fi +echo "Build with tag=${TAG} BRANCH=${BRANCH} dev?=${DEV} platforms?=${PLATFORMS}" + + +echo "Destroying old multiarch build container" +docker buildx rm multiarch +echo "Creating new buildx container" +docker buildx create --name multiarch --platform linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64 --config ./buildkit.toml --use --driver-opt image=moby/buildkit:master + if [ $DEV -eq 1 ] then + echo "Build -DEV- with tag=${TAG} BRANCH=${BRANCH} platforms?=${PLATFORMS}" # Use this script to locally build the docker image docker buildx build --push --platform $PLATFORMS \ -t harbor.hemna.com/hemna6969/aprsd:$TAG \ - -f Dockerfile-dev --no-cache . + -f Dockerfile-dev --build-arg branch=$BRANCH --no-cache . else # Use this script to locally build the docker image + echo "Build with tag=${TAG} BRANCH=${BRANCH} platforms?=${PLATFORMS}" docker buildx build --push --platform $PLATFORMS \ -t hemna6969/aprsd:$VERSION \ - -t hemna6969/aprsd:latest \ - -t harbor.hemna.com/hemna6969/aprsd:latest \ + -t hemna6969/aprsd:$TAG \ + -t harbor.hemna.com/hemna6969/aprsd:$TAG \ -t harbor.hemna.com/hemna6969/aprsd:$VERSION \ -f Dockerfile . - - fi