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 @@
FROM debian:$DIST-slim
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 $DIST main" > /etc/apt/sources.list.d/logilab.list
RUN wget -O - | 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 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
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
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)
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")
built_images = []
failed_images = []
for image in images:
set -e
usage() {
echo "$0 (-d <dir> | -u <url to tar.gz>)"
options=$(getopt hd:u: "$@")
eval set -- "$options"
while true;
case "$1" in
-h) usage && exit 0;;
-d) dir=$2; shift 2;;
-u) url=$2; shift 2;;
*) break;;
(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"
apt-get update
tmp=$(mktemp -d)
cd "$src" && python3 sdist
tar -C "$tmp" --strip-component=1 -xf "$src"/dist/*.tar.gz
pushd $tmp
cp -r "$src/debian" .
dch -v $(python3 --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