git repos / sago_web_git

Dockerfile

browsing at commit = 4884661bf7b1a182586a207ea9e977adeef641ae

raw · blame · history

# Multi git frontend.
#
# CppCMS is not packaged in Ubuntu, so the build stage compiles it from source
# (matching the 2.x series). The runtime stage carries only the shared
# libraries and the application.

FROM ubuntu:24.04 AS build

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        cmake \
        pkg-config \
        git \
        ca-certificates \
        python3 \
        python-is-python3 \
        libpcre3-dev \
        zlib1g-dev \
        libssl-dev \
        libicu-dev \
        libgit2-dev \
    && rm -rf /var/lib/apt/lists/*

# Build and install CppCMS (provides libcppcms, libbooster and cppcms_tmpl_cc).
RUN git clone --depth 1 --recurse-submodules \
        https://github.com/artyom-beilis/cppcms /tmp/cppcms \
    && cmake -S /tmp/cppcms -B /tmp/cppcms/build \
        -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
    && cmake --build /tmp/cppcms/build -j"$(nproc)" \
    && cmake --install /tmp/cppcms/build \
    && ldconfig

WORKDIR /src
COPY . /src
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
    && cmake --build build -j"$(nproc)"

FROM ubuntu:24.04 AS runtime

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
        libpcre3 \
        zlib1g \
        libssl3 \
        libicu74 \
        libgit2-1.7 \
    && rm -rf /var/lib/apt/lists/*

COPY --from=build /usr/local/lib/libcppcms.so* /usr/local/lib/
COPY --from=build /usr/local/lib/libbooster.so* /usr/local/lib/
RUN ldconfig

COPY --from=build /src/build/git_frontend /app/git_frontend
COPY --from=build /src/static /app/static
COPY --from=build /src/config.json /app/config.json

WORKDIR /app

# Mount a directory of git repositories here.
ENV GIT_ROOT=/srv/git
VOLUME ["/srv/git"]
EXPOSE 11000

CMD ["/app/git_frontend", "-c", "/app/config.json"]