aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Dockerfile
blob: 11ce0b0cd201eb3faac41d8c98627b6dc0034964 (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
40
41
42
43
44
FROM alpine:3.18 AS base

ARG install_dir="/app/install"

FROM base AS builder

RUN build_deps='bash bsd-compat-headers build-base clang cmake coreutils git libgit2-dev libsodium-dev py3-pytest sqlite-dev valgrind' && \
    apk add -q --no-cache $build_deps

ARG COMPILER=clang
ARG CONFIGURATION=Release
ARG DEFAULT_HOST=127.0.0.1
ARG DEFAULT_PORT=5556

ARG src_dir="/app/src"
ARG install_dir

COPY [".", "$src_dir"]

RUN cd -- "$src_dir" && \
    make install \
        "COMPILER=$COMPILER" \
        "CONFIGURATION=$CONFIGURATION" \
        "DEFAULT_HOST=$DEFAULT_HOST" \
        "DEFAULT_PORT=$DEFAULT_PORT" \
        "INSTALL_PREFIX=$install_dir" && \
    ulimit -n 1024 && \
    make test/docker

FROM base

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

RUN runtime_deps='libgit2 libsodium sqlite tini' && \
    apk add -q --no-cache $runtime_deps

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

ENV PATH="$install_dir/bin:${PATH}"
WORKDIR "$install_dir/bin"

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