mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-17 13:51:54 -05:00
Added Dockerfile-dev and updated build.sh
Build.sh is used for multi-architecture building of docker images.
This commit is contained in:
parent
933917bf9d
commit
239e784d51
50
docker/Dockerfile-dev
Normal file
50
docker/Dockerfile-dev
Normal file
@ -0,0 +1,50 @@
|
||||
FROM python:3.8-slim as aprsd
|
||||
|
||||
# Dockerfile for building a container during aprsd development.
|
||||
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 VIRTUAL_ENV=$HOME/.venv3
|
||||
ENV UID=${UID:-1000}
|
||||
ENV GID=${GID:-1000}
|
||||
|
||||
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 addgroup --gid 1001 $APRS_USER
|
||||
RUN useradd -m -u $UID -g $APRS_USER $APRS_USER
|
||||
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
|
||||
USER $APRS_USER
|
||||
RUN pip3 install wheel
|
||||
RUN python3 -m venv $VIRTUAL_ENV
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
RUN echo "export PATH=\$PATH:\$HOME/.local/bin" >> $HOME/.bashrc
|
||||
VOLUME ["/config", "/plugins"]
|
||||
|
||||
WORKDIR $HOME
|
||||
RUN mkdir $INSTALL
|
||||
RUN git clone -b $APRSD_BRANCH $APRSD $INSTALL/aprsd
|
||||
RUN cd $INSTALL/aprsd && pip3 install .
|
||||
RUN which aprsd
|
||||
USER root
|
||||
RUN mkdir -p /config
|
||||
RUN aprsd sample-config > /config/aprsd.yml
|
||||
RUN chown -R $APRS_USER:$APRS_USER /config
|
||||
|
||||
# override this to run another configuration
|
||||
ENV CONF default
|
||||
USER $APRS_USER
|
||||
|
||||
ADD bin/run.sh $HOME/
|
||||
ENTRYPOINT ["/home/aprs/run.sh"]
|
@ -1,12 +1,64 @@
|
||||
#!/bin/bash
|
||||
# Official docker image build script.
|
||||
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
usage: $0 options
|
||||
|
||||
OPTIONS:
|
||||
-t The tag/version (${TAG}) (default = master)
|
||||
-d Use Dockerfile-dev for a git clone build
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
ALL_PLATFORMS=0
|
||||
DEV=0
|
||||
TAG="master"
|
||||
|
||||
while getopts “t:da” OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
t)
|
||||
TAG=$OPTARG
|
||||
;;
|
||||
a)
|
||||
ALL_PLATFORMS=1
|
||||
;;
|
||||
d)
|
||||
DEV=1
|
||||
;;
|
||||
?)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
VERSION="1.6.0"
|
||||
|
||||
# Use this script to locally build the docker image
|
||||
docker buildx build --push --platform linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64 \
|
||||
-t hemna6969/aprsd:$VERSION \
|
||||
-t hemna6969/aprsd:latest \
|
||||
-t harbor.hemna.com/hemna6969/aprsd:latest \
|
||||
-t harbor.hemna.com/hemna6969/aprsd:$VERSION \
|
||||
-f Dockerfile .
|
||||
if [ $ALL_PLATFORMS -eq 1 ]
|
||||
then
|
||||
PLATFORMS="linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64"
|
||||
else
|
||||
PLATFORMS="linux/amd64"
|
||||
fi
|
||||
|
||||
if [ $DEV -eq 1 ]
|
||||
then
|
||||
# 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 .
|
||||
else
|
||||
# Use this script to locally build the docker image
|
||||
docker buildx build --push --platform $PLATFORMS \
|
||||
-t hemna6969/aprsd:$VERSION \
|
||||
-t hemna6969/aprsd:latest \
|
||||
-t harbor.hemna.com/hemna6969/aprsd:latest \
|
||||
-t harbor.hemna.com/hemna6969/aprsd:$VERSION \
|
||||
-f Dockerfile .
|
||||
|
||||
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user