From d87e0e40fbd6e93d799d7c72ddf10d663b1b2bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20O=C5=BEana?= Date: Tue, 19 Mar 2024 10:24:33 +0100 Subject: [PATCH] Move Dockerfile --- .docker/minicrawler/Dockerfile | 88 ++++++++++++++++------------------ docker-bake.hcl | 29 +++++++++++ 2 files changed, 71 insertions(+), 46 deletions(-) create mode 100644 docker-bake.hcl diff --git a/.docker/minicrawler/Dockerfile b/.docker/minicrawler/Dockerfile index 13c63d8..eaeab37 100644 --- a/.docker/minicrawler/Dockerfile +++ b/.docker/minicrawler/Dockerfile @@ -1,52 +1,48 @@ -FROM debian:latest +FROM debian:bookworm-slim as minicrawler -ENV LANGUAGE en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL C -ENV DEBIAN_FRONTEND noninteractive - -ENV CFLAGS "-O3 -g -fstack-protector-strong" - -RUN apt-get -qqy update && apt-get -qqy install \ -# minicrawler dev deps - libc-ares-dev \ - zlib1g-dev \ - libicu-dev \ - libssl-dev \ - libnghttp2-dev \ -\ -# build tool - make \ - autoconf \ - automake \ - autotools-dev \ - build-essential \ - libtool \ - gcc \ -\ -# php for testing - php \ -\ -# tools - curl \ - ca-certificates \ - apt-transport-https \ - locales \ - tzdata \ -\ - && sed -i 's/^.*\(en_US.UTF-8\)/\1/' /etc/locale.gen \ - && locale-gen \ - && ln -sf "/usr/share/zoneinfo/Europe/Prague" /etc/localtime && dpkg-reconfigure tzdata \ - && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \ -# update certificates \ - && mkdir -p /var/lib/certs \ - && curl -s -f -L https://curl.se/ca/cacert.pem -o ca-bundle.crt \ - && cat /etc/ssl/certs/ca-certificates.crt >> ca-bundle.crt \ - && cp -v ca-bundle.crt /var/lib/certs/ca-bundle.crt +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update && apt -y install \ + # minicrawler dev deps + libc-ares-dev \ + zlib1g-dev \ + libicu-dev \ + libssl-dev \ + libnghttp2-dev \ + \ + # build tool + make \ + autoconf \ + automake \ + autotools-dev \ + build-essential \ + libtool \ + gcc \ + \ + # tools + curl \ + ca-certificates \ + apt-transport-https \ + locales \ + tzdata \ + \ + && sed -i 's/^.*\(en_US.UTF-8\)/\1/' /etc/locale.gen \ + && locale-gen \ + && ln -sf "/usr/share/zoneinfo/Europe/Prague" /etc/localtime && dpkg-reconfigure tzdata \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \ + # update certificates \ + && mkdir -p /var/lib/certs \ + && curl -s -f -L https://curl.se/ca/cacert.pem -o ca-bundle.crt \ + && cat /etc/ssl/certs/ca-certificates.crt >> ca-bundle.crt \ + && cp -v ca-bundle.crt /var/lib/certs/ca-bundle.crt ENV LC_ALL en_US.UTF-8 -ARG PREFIX="/var/lib/minicrawler/usr" +# copy minicrawler source +WORKDIR /minicrawler +COPY . /minicrawler -WORKDIR /minicrawler \ No newline at end of file +RUN ./autogen.sh \ + && ./configure --prefix=/var/lib/minicrawler/usr --with-ca-bundle=/var/lib/certs/ca-bundle.crt --with-ca-path=/etc/ssl/certs \ + && make || exit 42 \ + && make install || exit 43 diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 0000000..03e81e0 --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,29 @@ +# Define the Docker Compose services block +# https://docs.docker.com/build/bake/reference/ + +#################################################################################################### +# docker buildx bake --file docker-bake.hcl minicrawler --push --no-cache --progress=plain +#################################################################################################### + +target "minicrawler" { + args = { + MINICRAWLER_VERSION = "v5.2.6" + } + context = "git@gitlab.int.wikidi.net:testomato/minicrawler.git" + dockerfile = ".docker/minicrawler/Dockerfile" + platforms = ["linux/amd64", "linux/arm64"] + ssh = ["default"] + pull = true + tags = [ + "dr.brzy.cz/testomato/minicrawler:latest", + "dr.brzy.cz/testomato/minicrawler:v5.2.6", + ] +} + +#################################################################################################### +# docker buildx bake --file docker-bake.hcl --push --no-cache --progress=plain +#################################################################################################### + +group "default" { + targets = ["minicrawler"] +} \ No newline at end of file