From 06dff027285753c67903cba4452037ab433f7b2f Mon Sep 17 00:00:00 2001 From: mmd-osm Date: Mon, 22 Apr 2024 23:27:23 +0200 Subject: [PATCH 1/3] Add build on Ubuntu 24.04 --- .github/workflows/docker_2404.yml | 15 ++++++++ docker/ubuntu/Dockerfile2404 | 62 +++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/docker_2404.yml create mode 100644 docker/ubuntu/Dockerfile2404 diff --git a/.github/workflows/docker_2404.yml b/.github/workflows/docker_2404.yml new file mode 100644 index 00000000..ffa23c09 --- /dev/null +++ b/.github/workflows/docker_2404.yml @@ -0,0 +1,15 @@ +name: Build on Ubuntu 24.04 + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Build Docker images + uses: docker/build-push-action@v5 + with: + file: docker/ubuntu/Dockerfile2404 diff --git a/docker/ubuntu/Dockerfile2404 b/docker/ubuntu/Dockerfile2404 new file mode 100644 index 00000000..632b6bde --- /dev/null +++ b/docker/ubuntu/Dockerfile2404 @@ -0,0 +1,62 @@ +# vim:set ft=dockerfile: +FROM ubuntu:24.04 AS builder + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update -qq && \ + apt-get install -y gcc g++ make cmake \ + libfcgi-dev libxml2-dev libmemcached-dev libbrotli-dev \ + libboost-program-options-dev libcrypto++-dev libyajl-dev \ + libpqxx-dev zlib1g-dev libfmt-dev \ + postgresql-16 postgresql-server-dev-all \ + --no-install-recommends && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Copy the main application. +COPY . ./ + +# Compile, install and remove source +RUN mkdir build && cd build && \ + CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release && \ + make -j${nproc} && \ + ctest --output-on-failure && \ + strip openstreetmap-cgimap && \ + cp openstreetmap-cgimap ../ + +FROM ubuntu:24.04 + +RUN apt-get update -qq && \ + apt-get install -y \ + libfcgi-bin libmemcached11 libboost-program-options1.83.0 \ + libxml2 libcrypto++8 libyajl2 libpqxx-7.8t64 zlib1g libbrotli1 libfmt9 \ + --no-install-recommends && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=builder /app/openstreetmap-cgimap /usr/local/bin + +RUN groupadd -g 61000 cgimap && \ + useradd -g 61000 -l -M -s /bin/false -u 61000 cgimap + +USER cgimap + +ENV CGIMAP_HOST db +ENV CGIMAP_DBNAME openstreetmap +ENV CGIMAP_USERNAME openstreetmap +ENV CGIMAP_PASSWORD openstreetmap +ENV CGIMAP_MEMCACHE memcached +ENV CGIMAP_RATELIMIT 204800 +ENV CGIMAP_MAXDEBT 250 +ENV CGIMAP_MODERATOR_RATELIMIT 1048576 +ENV CGIMAP_MODERATOR_MAXDEBT 1024 +ENV CGIMAP_PORT 8000 +ENV CGIMAP_INSTANCES 10 + +EXPOSE 8000 + +ENTRYPOINT /usr/local/bin/openstreetmap-cgimap --pidfile /tmp/cgimap.pid --logfile=/proc/1/fd/1 --daemon && \ + tail --pid=$(cat /tmp/cgimap.pid) -f /dev/null + From 02e0cf56c48d5191c73595c0a8af8cc43cc4333e Mon Sep 17 00:00:00 2001 From: mmd-osm Date: Tue, 23 Apr 2024 19:15:29 +0200 Subject: [PATCH 2/3] Return exit code 0 for --help --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 768bf3d6..3260e2b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -146,7 +146,7 @@ void get_options(int argc, char **argv, po::variables_map &options) { if (options.count("help")) { std::cout << desc << std::endl; output_backend_options(std::cout); - exit(1); + exit(0); } po::store(po::parse_environment(desc, From f5068081f2104a2eca502137e1a35bfeb5813fe2 Mon Sep 17 00:00:00 2001 From: mmd-osm Date: Tue, 23 Apr 2024 19:30:03 +0200 Subject: [PATCH 3/3] Try to run cgimap --help in docker image --- .github/workflows/docker_2404.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker_2404.yml b/.github/workflows/docker_2404.yml index ffa23c09..386b4d92 100644 --- a/.github/workflows/docker_2404.yml +++ b/.github/workflows/docker_2404.yml @@ -7,9 +7,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - name: Build Docker images uses: docker/build-push-action@v5 with: file: docker/ubuntu/Dockerfile2404 + load: true + tags: cgimap:2404 + - name: Running Docker image + run: | + docker run --entrypoint /bin/bash cgimap:2404 -c "/usr/local/bin/openstreetmap-cgimap --help"