aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Dockerfile
blob: 3a5531da773588658ba607e9345bddf83a4aba39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM alpine:3.16 AS base

ARG install_dir="/app/install"

FROM base AS builder

RUN apk add --no-cache bsd-compat-headers build-base clang cmake libgit2-dev

ARG default_host=127.0.0.1

ARG src_dir="/app/src"
ARG build_dir="/app/build"
ARG install_dir

COPY [".", "$src_dir"]

RUN mkdir -- "$build_dir" && \
    cd -- "$build_dir" && \
    cmake \
         -D "DEFAULT_HOST=$default_host" \
         -D CMAKE_C_COMPILER=clang \
         -D CMAKE_BUILD_TYPE=Release \
         -D "CMAKE_INSTALL_PREFIX=$install_dir" \
         "$src_dir" && \
    make -j install

FROM base

LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>"

RUN apk add --no-cache tini libgit2

ARG install_dir
COPY --from=builder ["$install_dir", "$install_dir"]

WORKDIR "$install_dir/bin"

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["./cimple-server"]