Skip to content

Commit

Permalink
Add build system option to docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Woazboat committed Nov 27, 2023
1 parent ce900a8 commit 8bdc15a
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
.git*
.vagrant
/build/
*~
*.o
*.a
*.so
25 changes: 19 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ FROM ubuntu:20.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive

ARG BUILD_SYSTEM="autotools"

RUN apt-get update -qq && \
apt-get install -y gcc g++ make autoconf automake libtool \
apt-get install -y gcc g++ make autoconf automake libtool cmake ninja-build \
libfcgi-dev libxml2-dev libmemcached-dev \
libboost-program-options-dev \
libcrypto++-dev libyajl-dev \
Expand All @@ -20,11 +22,22 @@ WORKDIR /app
COPY . ./

# Compile, install and remove source
RUN ./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl && \
make -j3 && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap
RUN if [ "$BUILD_SYSTEM" = "cmake" ]; then \
mkdir build && cd build && \
CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" CMAKE_MAKE_PROGRAM=ninja cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -G Ninja && \
cmake --build . && \
cmake --build . -t test && \
strip openstreetmap-cgimap && \
cp openstreetmap-cgimap ../ ; \
elif [ "$BUILD_SYSTEM" = "autotools" ]; then \
./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap; \
else \
echo "Unknown build system ${BUILD_SYSTEM}" && exit 1; \
fi

FROM ubuntu:20.04

Expand Down
25 changes: 19 additions & 6 deletions Dockerfile2204
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ FROM ubuntu:22.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive

ARG BUILD_SYSTEM="autotools"

RUN apt-get update -qq && \
apt-get install -y gcc g++ make autoconf automake libtool \
apt-get install -y gcc g++ make autoconf automake libtool cmake ninja-build \
libfcgi-dev libxml2-dev libmemcached-dev \
libboost-program-options-dev libcrypto++-dev libyajl-dev \
libpqxx-dev zlib1g-dev libargon2-dev libfmt-dev \
Expand All @@ -19,11 +21,22 @@ WORKDIR /app
COPY . ./

# Compile, install and remove source
RUN ./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 && \
make check && \
strip openstreetmap-cgimap
RUN if [ "$BUILD_SYSTEM" = "cmake" ]; then \
mkdir build && cd build && \
CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" CMAKE_MAKE_PROGRAM=ninja cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -G Ninja && \
cmake --build . && \
cmake --build . -t test && \
strip openstreetmap-cgimap && \
cp openstreetmap-cgimap ../ ; \
elif [ "$BUILD_SYSTEM" = "autotools" ]; then \
./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap; \
else \
echo "Unknown build system ${BUILD_SYSTEM}" && exit 1; \
fi

FROM ubuntu:22.04

Expand Down
25 changes: 19 additions & 6 deletions Dockerfile_bookworm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ FROM debian:bookworm-slim AS builder

ENV DEBIAN_FRONTEND=noninteractive

ARG BUILD_SYSTEM="autotools"

RUN apt-get update -qq && \
apt-get install -y gcc g++ make autoconf automake libtool \
apt-get install -y gcc g++ make autoconf automake libtool cmake ninja-build \
libfcgi-dev libxml2-dev libmemcached-dev \
libboost-program-options-dev libcrypto++-dev libyajl-dev \
libpqxx-dev zlib1g-dev libargon2-dev libfmt-dev \
Expand All @@ -19,11 +21,22 @@ WORKDIR /app
COPY . ./

# Compile, install and remove source
RUN ./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap
RUN if [ "$BUILD_SYSTEM" = "cmake" ]; then \
mkdir build && cd build && \
CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" CMAKE_MAKE_PROGRAM=ninja cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -G Ninja && \
cmake --build . && \
cmake --build . -t test && \
strip openstreetmap-cgimap && \
cp openstreetmap-cgimap ../ ; \
elif [ "$BUILD_SYSTEM" = "autotools" ]; then \
./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap; \
else \
echo "Unknown build system ${BUILD_SYSTEM}" && exit 1; \
fi

FROM debian:bookworm-slim

Expand Down
25 changes: 19 additions & 6 deletions Dockerfile_trixie
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ FROM debian:trixie-slim AS builder

ENV DEBIAN_FRONTEND=noninteractive

ARG BUILD_SYSTEM="autotools"

RUN apt-get update -qq && \
apt-get install -y gcc g++ make autoconf automake libtool \
apt-get install -y gcc g++ make autoconf automake libtool cmake ninja-build \
libfcgi-dev libxml2-dev libmemcached-dev \
libboost-program-options-dev libcrypto++-dev libyajl-dev \
libpqxx-dev zlib1g-dev libargon2-dev libfmt-dev \
Expand All @@ -19,11 +21,22 @@ WORKDIR /app
COPY . ./

# Compile, install and remove source
RUN ./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap
RUN if [ "$BUILD_SYSTEM" = "cmake" ]; then \
mkdir build && cd build && \
CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" CMAKE_MAKE_PROGRAM=ninja cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -G Ninja && \
cmake --build . && \
cmake --build . -t test && \
strip openstreetmap-cgimap && \
cp openstreetmap-cgimap ../ ; \
elif [ "$BUILD_SYSTEM" = "autotools" ]; then \
./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap; \
else \
echo "Unknown build system ${BUILD_SYSTEM}" && exit 1; \
fi

FROM debian:trixie

Expand Down

0 comments on commit 8bdc15a

Please sign in to comment.