Commit f226efc5 authored by Carine Dengler's avatar Carine Dengler
Browse files

chore: buildpackage has been moved to infra/dockerfiles

parent ef9654e3ecc7
......@@ -5,4 +5,3 @@
!check-docker-updates.sh
!get-cube
!docker-cubicweb-helper
!buildpackage
ARG DIST
FROM debian:$DIST-slim
ARG DIST
RUN apt-get update && \
apt-get -y --no-install-recommends install \
bzip2 \
wget \
gnupg \
ca-certificates \
devscripts \
python3 \
python3-setuptools \
equivs \
&& rm -rf /var/lib/apt/lists/*
RUN echo "deb http://apt.logilab.fr $DIST main" > /etc/apt/sources.list.d/logilab.list
RUN wget -O - https://apt.logilab.fr/key.asc | apt-key --keyring /etc/apt/trusted.gpg.d/logilab.gpg add -
RUN mkdir /repo
RUN echo -n "" | gzip -9c > /repo/Packages.gz
RUN echo "deb [trusted=yes] file:///repo ./" > /etc/apt/sources.list.d/local.list
COPY buildpackage /usr/local/bin/
RUN chmod +x /usr/local/bin/buildpackage
......@@ -174,33 +174,3 @@ copying useless files inside the docker image. For example::
Always pull the base image before running the build. Base images are rebuild in
case of debian security update or new pypi releases.
buildpackage images
-------------------
These images can be used to build debian package(s) and publish them to a repo
located in /repo suitable for use within a multi-stage build.
Example, given all dependencies are available on "deb http://apt.logilab.fr buster cubicweb-3.29" repository and given you're working in the source tree of `cubicweb-blog`_::
FROM logilab/cubicweb:buildpackage as buildpackage
COPY . /src
RUN buildpackage -d /src
FROM logilab/cubicweb:3.29
COPY --from=buildpackage /repo /repo
RUN apt-get update && apt-get -y --no-install-recommends install cubicweb-blog
ENV CUBE=blog
USER cubicweb
RUN docker-cubicweb-helper create-instance
If you need to build more packages, or build specific revisions, the
``buildpackage`` script can also build from an archive::
FROM logilab/cubicweb:buster-buildpackage
RUN buildpackage -u https://hg.logilab.org/master/cubes/comment/archive/tip.tar.gz
COPY . /src
RUN buildpackage -d /src
[...]
......@@ -191,27 +191,7 @@ def red(text):
return "\033[0;31m" + text + "\033[0m"
def build_buildpackage(dist):
tag = "{}:{}-buildpackage".format(REGISTRY, dist)
check_call(
"docker",
"build",
"-t",
tag,
"--build-arg",
"DIST={}".format(dist),
"-f",
"Dockerfile.buildpackage",
".",
)
def build(debian_dists: List[str], images: List[CubicWebImage] = [], rebuild=False):
for dist in debian_dists:
if rebuild:
# pull base images
check_call("docker", "pull", f"debian:{dist}-slim")
build_buildpackage(dist)
built_images = []
failed_images = []
for image in images:
......
#!/bin/bash
set -e
usage() {
echo "$0 (-d <dir> | -u <url to tar.gz>)"
}
options=$(getopt hd:u: "$@")
eval set -- "$options"
while true;
do
case "$1" in
-h) usage && exit 0;;
-d) dir=$2; shift 2;;
-u) url=$2; shift 2;;
*) break;;
esac
done
(test -z "$dir" && test -z "$url") && usage && exit 64
(test -n "$dir" && test -n "$url") && usage && exit 64
if test -n "$url"; then
src=$(mktemp -d)
dst=$(mktemp)$(basename "$url")
trap 'rm -rf "$src"' exit
wget -q -O "$dst" "$url"
tar -C "$src" --strip-component=1 -xf "$dst"
else
src=$dir
fi
apt-get update
tmp=$(mktemp -d)
cd "$src" && python3 setup.py sdist
tar -C "$tmp" --strip-component=1 -xf "$src"/dist/*.tar.gz
pushd $tmp
cp -r "$src/debian" .
dch -v $(python3 setup.py --version)-1 -D unstable 'Snapshot release'
yes | mk-build-deps -i
dpkg-buildpackage -us -uc --build=binary
dcmd cp ../*_amd64.changes /repo/
cd /repo && dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
rm -rf /var/lib/apt/lists/*
rm -rf "$tmp"
apt-get purge -y \*-build-deps
apt-get autoremove --purge -y
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment