diff --git a/docker-build/Dockerfile b/docker-build/Dockerfile index 0700fbcac..658a1b7bb 100644 --- a/docker-build/Dockerfile +++ b/docker-build/Dockerfile @@ -1,21 +1,27 @@ -# Idea from https://github.com/ok2cqr/cqrlog +# Base Image +FROM ubuntu:latest AS hamlib-base-image -FROM ubuntu:latest +ENV DEBIAN_FRONTEND="noninteractive" TZ="Etc/UTC" -RUN apt-get update && apt-get -y upgrade +RUN apt-get update && apt-get install -y build-essential automake libtool python3 && rm -rf /var/lib/apt/lists/* -ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London" +# Builder Image +FROM hamlib-base-image AS hamlib-builder -RUN apt-get install -y git build-essential automake libtool +COPY . /tmp/build -RUN mkdir -p /usr/local/hamlib-alpha /home/hamlib/build +WORKDIR /tmp/build -# Mount point for the git repository: -VOLUME ["/home/hamlib/build"] +RUN mkdir -p /tmp/local -# Mount point for the result of the build: -VOLUME ["/usr/local/hamlib-alpha"] +RUN ./bootstrap && ./configure --prefix=/tmp/local \ + && make clean && make -j && make install -WORKDIR /home/hamlib/build +# Runtime Image +FROM ubuntu:latest AS hamlib-runtime -ENTRYPOINT rm -rf build && mkdir -p build && cd build && ../bootstrap && ../configure --prefix=/usr/local/hamlib-alpha && make clean && make && make install +COPY --from=hamlib-builder /tmp/local/bin /usr/local/bin +COPY --from=hamlib-builder /tmp/local/lib /usr/local/lib +COPY --from=hamlib-builder /tmp/local/share /usr/local/share + +ENV LD_LIBRARY_PATH="/usr/local/lib" diff --git a/docker-build/README.docker b/docker-build/README.docker index c5ed7822c..9c3cbe693 100644 --- a/docker-build/README.docker +++ b/docker-build/README.docker @@ -1,13 +1,7 @@ -This is all about building hamlib inside docker container - so that you do not need to install dependencies on your local machine. -1. Build docker container +# Build, execute from the repository root +`docker buildx build -t hamlib-runtime -f docker-build/Dockerfile .` -(cd docker-build && docker build --no-cache -t this.registry.is.invalid/hamlib-build .) +# Run the hamlib-runtime +`docker run -it hamlib-runtime bash` -2. Build hamlib - -docker run -ti -u root -v $(pwd):/home/hamlib/build -v /usr/local/hamlib-alpha:/usr/local/hamlib-alpha this.registry.is.invalid/hamlib-build - -3. Execute hamlib - -/usr/local/hamlib-alpha/bin/rigctl