Skip to content

Commit

Permalink
Merge pull request #399 from mmd-osm/patch/ubuntu2404
Browse files Browse the repository at this point in the history
Add build on Ubuntu 24.04
  • Loading branch information
mmd-osm authored Apr 23, 2024
2 parents 001dc8a + f506808 commit 6c0c600
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/docker_2404.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build on Ubuntu 24.04

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- 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"
62 changes: 62 additions & 0 deletions docker/ubuntu/Dockerfile2404
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6c0c600

Please sign in to comment.