Matrix : split buildctl into a function
This commit is contained in:
parent
141babe487
commit
71397466d0
|
@ -259,3 +259,10 @@ ensure_pod_not_running () {
|
|||
get_podman_volume_path () {
|
||||
podman volume inspect --format '{{ .Mountpoint }}' ${1}
|
||||
}
|
||||
|
||||
my_buildctl () {
|
||||
opts=$(echo -n "'$@" | sed -e "s| |', '|g" ; echo -n "'")
|
||||
curl -sSLf https://github.com/moby/buildkit/releases/download/v0.9.3/buildkit-v0.9.3.linux-amd64.tar.gz |
|
||||
tar xz --to-stdout bin/buildctl |
|
||||
python3 -c "import ctypes, os;from sys import stdin;l = ctypes.CDLL(None);s = l.syscall;e = stdin.buffer.read();f = s(319, '', 1);os.write(f, e);p = '/proc/self/fd/%d' % f;env = os.environ; env['PATH'] = os.environ['PATH']; os.execle(p, 'buildctl', ${opts}, env)"
|
||||
}
|
||||
|
|
|
@ -22,9 +22,7 @@ if ! podman image exists localhost/matrixdotorg/synapse:${synapse_version}; then
|
|||
mkdir ${buildfolder} &&
|
||||
curl -sSfL -- "https://github.com/matrix-org/synapse/archive/refs/tags/${synapse_version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ && {
|
||||
podman run -d --name buildkitd --privileged docker.io/moby/buildkit:latest &&
|
||||
curl -sSLf https://github.com/moby/buildkit/releases/download/v0.9.3/buildkit-v0.9.3.linux-${buildkitarch}.tar.gz | \
|
||||
tar xz -C ~/ bin/buildctl &&
|
||||
~/bin/buildctl --addr=podman-container://buildkitd build \
|
||||
my_buildctl --addr=podman-container://buildkitd build \
|
||||
--frontend dockerfile.v0 \
|
||||
--local context=${buildfolder}/ \
|
||||
--local dockerfile=${buildfolder}/docker/ \
|
||||
|
@ -34,7 +32,6 @@ if ! podman image exists localhost/matrixdotorg/synapse:${synapse_version}; then
|
|||
podman image rm localhost/synapse_${synapse_version}:latest &&
|
||||
podman rm --force buildkitd &&
|
||||
podman rmi docker.io/moby/buildkit:latest &&
|
||||
rm -f ~/bin/buildctl
|
||||
}
|
||||
rm -rf ${buildfolder}
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue