diff --git a/docker/Dockerfile b/docker/Dockerfile index a07b82f..5b8f9fe 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3-bullseye as aprsd +#FROM python:3-bullseye as aprsd +FROM ubuntu:focal as aprsd # Dockerfile for building a container during aprsd development. @@ -13,22 +14,17 @@ ENV GID=${GID:-1000} ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive RUN apt update RUN apt install -y git build-essential -RUN apt install -y libffi-dev python3-dev libssl-dev -#RUN apt-get install -y apt-utils -#RUN apt-get install -y pkg-config -#RUN apt upgrade -y -#RUN apk add --update git wget bash -#RUN apk add --update gcc linux-headers musl-dev libffi-dev libc-dev -#RUN apk add --update openssl-dev -#RUN add cmd:pip3 lsb-release +RUN apt install -y libffi-dev python3-dev libssl-dev libxml2-dev libxslt-dev +RUN apt install -y python3 python3-pip python3-dev python3-lxml RUN addgroup --gid $GID $APRS_USER RUN useradd -m -u $UID -g $APRS_USER $APRS_USER # Install aprsd -RUN /usr/local/bin/pip3 install aprsd==2.3.1 +RUN pip install aprsd # Ensure /config is there with a default config file USER root @@ -43,3 +39,6 @@ VOLUME ["/config", "/plugins"] USER $APRS_USER ADD bin/run.sh /usr/local/bin ENTRYPOINT ["/usr/local/bin/run.sh"] + +HEALTHCHECK --interval=5m --timeout=12s --start-period=30s \ + CMD aprsd healthcheck --config /config/aprsd.yml --url http://localhost:8001/stats diff --git a/docker/Dockerfile-dev b/docker/Dockerfile-dev index 2f0937e..eeb2a1f 100644 --- a/docker/Dockerfile-dev +++ b/docker/Dockerfile-dev @@ -1,4 +1,5 @@ -FROM python:3.8-slim as aprsd +# syntax=docker/dockerfile:1 +FROM ubuntu:focal as aprsd # Dockerfile for building a container during aprsd development. ARG branch @@ -13,11 +14,14 @@ ENV VIRTUAL_ENV=$HOME/.venv3 ENV UID=${UID:-1000} ENV GID=${GID:-1000} +ENV DEBIAN_FRONTEND=noninteractive ENV INSTALL=$HOME/install RUN apt update -RUN apt install -y git build-essential -RUN apt install -y libffi-dev python3-dev libssl-dev -RUN apt install -y bash fortune +RUN apt install -y --no-install-recommends git build-essential bash fortune +RUN apt install -y libffi-dev python3-dev libssl-dev libxml2-dev libxslt-dev +RUN apt install -y python3 python3-pip python3-dev python3-lxml +#RUN apt-get clean +RUN apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall netbase RUN addgroup --gid 1001 $APRS_USER RUN useradd -m -u $UID -g $APRS_USER $APRS_USER @@ -25,17 +29,21 @@ RUN useradd -m -u $UID -g $APRS_USER $APRS_USER ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 +WORKDIR $HOME USER $APRS_USER -RUN pip3 install wheel +RUN pip install wheel #RUN python3 -m venv $VIRTUAL_ENV -ENV PATH="$VIRTUAL_ENV/bin:$PATH" +#ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN echo "export PATH=\$PATH:\$HOME/.local/bin" >> $HOME/.bashrc +RUN cat $HOME/.bashrc USER root WORKDIR $HOME RUN mkdir $INSTALL RUN git clone -b $APRSD_BRANCH $APRSD $INSTALL/aprsd -RUN cd $INSTALL/aprsd && pip3 install . +RUN cd $INSTALL/aprsd && pip3 install -v . +RUN ls -al /usr/local/bin +RUN ls -al /usr/bin RUN which aprsd RUN mkdir -p /config RUN aprsd sample-config > /config/aprsd.yml @@ -48,3 +56,6 @@ VOLUME ["/config", "/plugins"] ADD bin/run.sh $HOME/ ENTRYPOINT ["/home/aprs/run.sh"] + +HEALTHCHECK --interval=5m --timeout=12s --start-period=30s \ + CMD aprsd healthcheck --config /config/aprsd.yml --url http://localhost:8001/stats diff --git a/docker/bin/run.sh b/docker/bin/run.sh index 667b7a7..88fb25e 100755 --- a/docker/bin/run.sh +++ b/docker/bin/run.sh @@ -20,4 +20,4 @@ if [ ! -e "$APRSD_CONFIG" ]; then aprsd sample-config > $APRSD_CONFIG fi -/usr/local/bin/aprsd server -c $APRSD_CONFIG --loglevel DEBUG +exec aprsd server -c $APRSD_CONFIG --loglevel DEBUG diff --git a/docker/build.sh b/docker/build.sh index 68f6dbc..7cdeca1 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,6 +1,10 @@ #!/bin/bash # Official docker image build script. +# 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 + usage() { cat << EOF @@ -40,11 +44,12 @@ do esac done -VERSION="2.3.1" +VERSION="2.4.2" if [ $ALL_PLATFORMS -eq 1 ] then - PLATFORMS="linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64" + PLATFORMS="linux/arm/v7,linux/arm64,linux/amd64" + #PLATFORMS="linux/arm/v7,linux/arm/v6,linux/amd64" else PLATFORMS="linux/amd64" fi @@ -54,8 +59,10 @@ 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 --platform linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64 --config ./buildkit.toml --use --driver-opt image=moby/buildkit:master +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 [ $DEV -eq 1 ] then @@ -68,6 +75,7 @@ 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 \ + --allow security.insecure \ -t hemna6969/aprsd:$VERSION \ -t hemna6969/aprsd:$TAG \ -t harbor.hemna.com/hemna6969/aprsd:$TAG \