This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
     new b533ed93 DISPATCH-2338 - dockerfiles: Introduce Debian-based slim 
image w/ CI tests (#1550)
b533ed93 is described below

commit b533ed930ff5fe7d55fec562b4480048a17a0e5d
Author: Ievgen Popovych <[email protected]>
AuthorDate: Tue Apr 19 16:51:18 2022 +0300

    DISPATCH-2338 - dockerfiles: Introduce Debian-based slim image w/ CI tests 
(#1550)
    
    * NO-JIRA: dockerfiles: Introduce Debian-based slim image
    
    Use Debian stable release slim image with multistage build to
    keep image size reasonable (143MB compared to 1.39GB Ubuntu based image).
    
    Other changes compared to Ubuntu based image:
    * libuv is enabled
    * a bit more careful work with dependencies
    * allow building web console
    * faster builds with Ninja
    * build from release, not master; configurable
    * other minor changes in build process, etc
    
    Signed-off-by: Ievgen Popovych <[email protected]>
    
    * dockerfiles: debian: use epoll, cosmetics, include ca-certificates
    
    * dockerfiles: debian: Clone from Github
    
    * dockerfiles: debian: Make sure /usr/share/qpid-dispatch exists
    
    ..to fix build with disabled web console.
    
    * dockerfiles: debian: Build from checked out source code
    
    * NO-JIRA: [GHA] Build Debian image
    
    * dockerfiles: debian: Install npm only if required (on build stage)
    
    * NO-JIRA: Add dockerignore
---
 .dockerignore                 | 32 ++++++++++++++++
 .github/workflows/build.yaml  | 12 ++++++
 dockerfiles/Dockerfile-debian | 86 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 130 insertions(+)

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..d00b3f01
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License
+#
+
+Dockerfile
+dockerfiles
+
+.git
+.idea
+**/.mypy_cache
+**/.pytest_cache
+**/__pycache__
+**/*.pyc
+
+build
+cmake-build-*
+tests/system_test.dir
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 85e58e82..36f07a95 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -630,3 +630,15 @@ jobs:
       - name: Output
         if: ${{ ! cancelled() }}
         run: cat target/rat.txt || echo "Unable to print output"
+
+  container-images:
+    name: Container Images
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+      - name: Build Debian image
+        uses: docker/build-push-action@v2
+        with:
+          file: dockerfiles/Dockerfile-debian
+          context: .
diff --git a/dockerfiles/Dockerfile-debian b/dockerfiles/Dockerfile-debian
new file mode 100644
index 00000000..87c8d2d9
--- /dev/null
+++ b/dockerfiles/Dockerfile-debian
@@ -0,0 +1,86 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# build with specifying root of repository as build context, e.g. `buildah -f 
dockerfiles/Dockerfile-debian .`
+
+FROM debian:bullseye-slim AS build
+
+LABEL org.opencontainers.image.authors="[email protected]"
+
+# UPGRADE: proton > 0.37.0: replace `python3/dist-packages` with 
`python3.9/site-packages/`
+ARG proton_version=0.37.0
+# Enable web console: use 'ON' or 'OFF'
+ARG enable_console=OFF
+
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends build-essential cmake 
pkg-config git ninja-build ca-certificates \
+        libssl-dev libsasl2-dev swig python3-dev libwebsockets-dev \
+        $(if [ "${enable_console}" = "ON" ]; then echo "npm"; fi) && \
+    rm -rf /var/lib/apt/lists/*
+
+# first, build Proton since there is no recent version packaged in Debian
+RUN git clone --depth 1 -b ${proton_version} 
https://github.com/apache/qpid-proton.git
+
+# build and install into system for laster usage by dispatch, but also install 
discretely so that it's easier to copy
+RUN mkdir /qpid-proton/build /qpid-proton/install-prefix && cd 
/qpid-proton/build && \
+       cmake .. -GNinja -DSYSINSTALL_BINDINGS=ON -DCMAKE_INSTALL_PREFIX=/usr 
-DSYSINSTALL_PYTHON=ON && \
+       cmake --build . --target install && \
+       cmake --install . --prefix /qpid-proton/install-prefix
+
+# build Dispatch Router
+ADD . /qpid-dispatch/
+RUN mkdir /qpid-dispatch/build /qpid-dispatch/install-prefix && cd 
/qpid-dispatch/build && \
+       cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DUSE_VALGRIND=NO 
-DCONSOLE_INSTALL=${enable_console} && \
+       cmake --build . && \
+       cmake --install . --prefix /qpid-dispatch/install-prefix && \
+       mkdir -p /usr/share/qpid-dispatch  # make sure directory exists even if 
web console is disabled
+
+# Uncomment the following line if you would like to run all the dispatch unit 
tests and system tests
+#RUN cd /qpid-dispatch/build && ctest -VV
+
+FROM debian:bullseye-slim
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends libsasl2-2 libsasl2-modules 
libwebsockets16 \
+        python3 libpython3.9 ca-certificates && \
+    rm -rf /var/lib/apt/lists/*
+
+# proton
+COPY --from=build /qpid-proton/install-prefix /usr/
+# python packages
+COPY --from=build /usr/lib/python3/dist-packages/proton 
/usr/lib/python3/dist-packages/proton
+COPY --from=build /usr/lib/python3/dist-packages/cproton.py 
/usr/lib/python3/dist-packages/_cproton.so \
+       /usr/lib/python3/dist-packages/
+
+# qpid-dispatch
+COPY --from=build /qpid-dispatch/install-prefix /usr/
+# leftovers that are not so compliant with prefix, at least with how we 
manipulate it
+COPY --from=build /etc/qpid-dispatch /etc/qpid-dispatch
+COPY --from=build /usr/share/qpid-dispatch /usr/share/qpid-dispatch
+COPY --from=build /etc/sasl2 /etc/sasl2
+COPY --from=build /usr/lib/python3.9/site-packages/qpid_dispatch 
/usr/lib/python3.9/site-packages/qpid_dispatch
+COPY --from=build /usr/lib/python3.9/site-packages/qpid_dispatch_site.py 
/usr/lib/python3.9/site-packages/
+
+# Add site-packages to the PYTHONPATH environment variable
+ENV PYTHONPATH=/usr/lib/python3.9/site-packages
+
+CMD ["qdrouterd"]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to