aboutsummaryrefslogtreecommitdiffstats
path: root/tools/build-env
diff options
context:
space:
mode:
Diffstat (limited to 'tools/build-env')
-rw-r--r--tools/build-env/Containerfile31
-rwxr-xr-xtools/build-env/build.sh16
-rwxr-xr-xtools/build-env/here.sh19
3 files changed, 66 insertions, 0 deletions
diff --git a/tools/build-env/Containerfile b/tools/build-env/Containerfile
new file mode 100644
index 00000000..6ba02ba0
--- /dev/null
+++ b/tools/build-env/Containerfile
@@ -0,0 +1,31 @@
+ARG os
+ARG dist
+FROM ${os:-debian}:${dist:-sid}
+ENV DEBIAN_FRONTEND noninteractive
+RUN set -ex; \
+ apt-get update; \
+ apt-get install -y --no-install-recommends \
+ ccache dh-lua libicu-dev libidn11-dev libssl-dev \
+ lua-bitop lua-dbi-mysql lua-dbi-postgresql lua-dbi-sqlite3 \
+ lua-event lua-expat lua-filesystem lua-ldap lua-sec lua-socket \
+ luarocks shellcheck mercurial; \
+ apt-get install -y ca-certificates dns-root-data; \
+ apt-get install -y lua-bit32 || true; \
+ apt-get install -y lua-busted || true; \
+ apt-get install -y lua-check || true; \
+ apt-get install -y lua-readline || true; \
+ apt-get install -y lua-unbound || true; \
+ update-alternatives --set lua-interpreter /usr/bin/lua5.4 || true \
+ apt-get clean
+
+# Place this file in an empty directory and build the image with
+# podman build . -t prosody.im/build-env
+#
+# Substituting podman for docker should work, where that is what's available.
+#
+# Then in a source directory, run:
+# podman run -it --rm -v "$PWD:$PWD" -w "$PWD" --entrypoint /bin/bash \
+# --userns=keep-id --network host prosody.im/build-env
+#
+# In the resulting environment everything required to compile and run prosody
+# is available, so e.g. `./configure; make; ./prosody` should Just Work!
diff --git a/tools/build-env/build.sh b/tools/build-env/build.sh
new file mode 100755
index 00000000..4351f8b8
--- /dev/null
+++ b/tools/build-env/build.sh
@@ -0,0 +1,16 @@
+#!/bin/sh -eux
+
+cd "$(dirname "$0")"
+
+containerify="$(command -v podman || command -v docker)"
+
+if [ -z "$containerify" ]; then
+ echo "podman or docker required" >&2
+ exit 1
+fi
+
+$containerify build -f ./Containerfile --squash \
+ --build-arg os="${2:-debian}" \
+ --build-arg dist="${1:-testing}" \
+ -t "prosody.im/build-env:${1:-testing}"
+
diff --git a/tools/build-env/here.sh b/tools/build-env/here.sh
new file mode 100755
index 00000000..1d5cb515
--- /dev/null
+++ b/tools/build-env/here.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -eux
+
+tag="testing"
+
+if [ "$#" -gt 0 ]; then
+ tag="$1"
+ shift
+fi
+
+containerify="$(command -v podman docker)"
+
+$containerify run -it --rm \
+ -v "$PWD:$PWD" \
+ -w "$PWD" \
+ -v "$HOME/.cache:$PWD/.cache" \
+ --entrypoint /bin/bash \
+ --userns=keep-id \
+ --network \
+ host "prosody.im/build-env:$tag" "$@"