diff options
author | Andreas Fankhauser (@tux-six) | 2022-07-06 22:23:22 +0200 |
---|---|---|
committer | Andreas Fankhauser (@tux-six) | 2022-07-06 22:23:22 +0200 |
commit | b627374773e3256fbd08fb204fcced3233b9c97e (patch) | |
tree | 0ce631914071a559441698d3d7a84e104d7b4395 /contrib | |
parent | 0d745cdb688eab40094c434d2564515705ce686b (diff) | |
download | bulk-ln-b627374773e3256fbd08fb204fcced3233b9c97e.zip bulk-ln-b627374773e3256fbd08fb204fcced3233b9c97e.tar.gz |
Add contrib Dockerfile about how to build from tarball
- rename README.txt -> README.md
- Add contrib Dockerfile as sample how to build from tarball
- Fix bashism 'set -o posix'
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/build-using-docker/Dockerfile | 34 | ||||
-rw-r--r-- | contrib/build-using-docker/README.md | 29 |
2 files changed, 63 insertions, 0 deletions
diff --git a/contrib/build-using-docker/Dockerfile b/contrib/build-using-docker/Dockerfile new file mode 100644 index 0000000..78f1a85 --- /dev/null +++ b/contrib/build-using-docker/Dockerfile @@ -0,0 +1,34 @@ + +ARG PARENT_IMAGE=alpine:3.16.0 +FROM $PARENT_IMAGE + +ARG GIT_TAG= +ARG CONFIGURE_OPTS= +ARG PKGS_TO_INSTALL="curl gcc git make musl-dev tar" +ARG PKGINIT=true +ARG PKGADD="apk add" +ARG PKGDEL="apk del" +ARG PKGCLEAN=true + +WORKDIR /work + +RUN true \ + && $PKGINIT \ + && $PKGADD $PKGS_TO_INSTALL \ + && git clone https://git.hiddenalpha.ch/bulk-ln.git . \ + && git config advice.detachedHead false \ + && if test -n "$GIT_TAG"; then git checkout "$GIT_TAG"; fi \ + && ./configure $CONFIGURE_OPTS \ + && make clean && make && make install \ + && find . -not -wholename './dist*' -delete \ + && find /work -exec chown 1000:1000 {} + \ + && $PKGDEL $PKGS_TO_INSTALL \ + && $PKGCLEAN \ + && true + +USER 1000:1000 + +# run for max 10 hrs. Because this container is not meant to stay running +# forever. +CMD ["sleep 36000"] + diff --git a/contrib/build-using-docker/README.md b/contrib/build-using-docker/README.md new file mode 100644 index 0000000..503136e --- /dev/null +++ b/contrib/build-using-docker/README.md @@ -0,0 +1,29 @@ + +Showcase how to build and install +================================= + +Make and install inside a dockerimage. + +```sh + curl -sSL http://git.hiddenalpha.ch/bulk-ln.git/plain/contrib/build-using-docker/Dockerfile | sudo docker build . -f - +``` + +Afer that we can use the image hash printed in last line to refer to our built +image (replace IMG_REF in commands below by that hash). Alternatively we could +add [`--tag`](https://docs.docker.com/engine/reference/commandline/build/) +option to our build command to give the resulting image a name. + +Most probably we wanna get the distribution archive. We can copy it out the +dockerimage to our host using: + +```sh + sudo docker run --rm -i IMG_REF sh -c 'true && cd dist && tar c *' | tar x +``` + +Or if we wanna browse the image or play around with the built utility we could +launch a shell. Once in the shell, try `bulk-ln --help`. + +```sh + sudo docker run --rm -ti IMG_REF sh +``` + |