Update Dockerfile and build.sh

This fixes a problem with the github workflow
This commit is contained in:
Hemna 2022-12-12 19:29:45 -05:00
parent 5891c71483
commit c1db238719
3 changed files with 27 additions and 18 deletions

View File

@ -41,7 +41,7 @@ jobs:
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: |
APRSD_VERSION=${{ inputs.aprsd_version }}
VERSION=${{ inputs.aprsd_version }}
push: true
tags: |
hemna6969/aprsd:v${{ inputs.aprsd_version }}

View File

@ -6,7 +6,7 @@ FROM ubuntu:focal as aprsd
ARG UID
ARG GID
ARG TZ
ARG APRSD_VERSION=2.5.9
ARG VERSION=2.6.0
ENV APRS_USER=aprs
ENV HOME=/home/aprs
ENV TZ=${TZ:-US/Eastern}
@ -14,7 +14,7 @@ ENV UID=${UID:-1000}
ENV GID=${GID:-1000}
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV APRSD_PIP_VERSION=${APRSD_VERSION}
ENV APRSD_PIP_VERSION=${VERSION}
ENV DEBIAN_FRONTEND=noninteractive

View File

@ -15,16 +15,19 @@ OPTIONS:
-t The tag/version (${TAG}) (default = master)
-d Use Dockerfile-dev for a git clone build
-b Branch to use (default = master)
-r Destroy and rebuild the buildx environment
EOF
}
ALL_PLATFORMS=0
DEV=0
REBUILD_BUILDX=0
TAG="latest"
BRANCH=${BRANCH:-master}
VERSION="2.6.0"
while getopts “hdat:b:” OPTION
while getopts “hdart:b:v:” OPTION
do
case $OPTION in
t)
@ -36,9 +39,15 @@ do
a)
ALL_PLATFORMS=1
;;
r)
REBUILD_BUILDX=1
;;
d)
DEV=1
;;
v)
VERSION=$OPTARG
;;
h)
usage
exit 0
@ -50,25 +59,28 @@ do
esac
done
VERSION="2.5.8"
if [ $ALL_PLATFORMS -eq 1 ]
then
PLATFORMS="linux/arm/v7,linux/arm64,linux/amd64"
#PLATFORMS="linux/arm/v7,linux/arm/v6,linux/amd64"
else
PLATFORMS="linux/amd64,linux/arm/v7"
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
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
echo "Creating new buildx container"
docker buildx create --name multiarch --driver docker-container --use --platform linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64 --config ./buildkit.toml --use --driver-opt image=moby/buildkit:master
docker buildx inspect --bootstrap
if [ $REBUILD_BUILDX -eq 1 ]
then
echo "Destroying old multiarch build container"
docker buildx rm multiarch
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
echo "Creating new buildx container"
docker buildx create --name multiarch --driver docker-container --use \
--config ./buildkit.toml --use \
--driver-opt image=moby/buildkit:master
docker buildx inspect --bootstrap
fi
if [ $DEV -eq 1 ]
then
@ -79,14 +91,11 @@ then
-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}"
echo "Build with tag=${TAG} BRANCH=${BRANCH} dev?=${DEV} platforms?=${PLATFORMS} VERSION=${VERSION}"
docker buildx build --push --platform $PLATFORMS \
--allow security.insecure \
--build-arg VERSION=$VERSION \
-t hemna6969/aprsd:$VERSION \
-t hemna6969/aprsd:$TAG \
-t hemna6969/aprsd:latest \
-t harbor.hemna.com/hemna6969/aprsd:$TAG \
-t harbor.hemna.com/hemna6969/aprsd:$VERSION \
-t harbor.hemna.com/hemna6969/aprsd:latest \
-f Dockerfile .
fi