Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (47 loc) · 2.19 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (47 loc) · 2.19 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM debian:bookworm-slim AS builder
ARG PROJECT_NAME=cs
ARG BUILD_MODE=release
ARG WITH_POSTGRESQL=ON
LABEL project="${PROJECT_NAME}"
RUN set -eux; \
apt-get update && apt-get install -y --no-install-recommends \
bash build-essential cmake g++ \
libssl-dev zlib1g-dev \
pkg-config ca-certificates git curl lsb-release && \
rm -rf /var/lib/apt/lists/*
RUN set -eux; \
if [ "${WITH_POSTGRESQL}" = "ON" ]; then \
install -d /usr/share/postgresql-common/pgdg && \
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail \
https://www.postgresql.org/media/keys/ACCC4CF8.asc && \
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
apt-get update && apt-get install -y --no-install-recommends libpq-dev && \
rm -rf /var/lib/apt/lists/*; \
fi
WORKDIR /opt/${PROJECT_NAME}
COPY . .
RUN set -eux; \
cp -r docker/conf/* conf/; \
PG_FLAG="--without-postgresql"; \
if [ "${WITH_POSTGRESQL}" = "ON" ]; then PG_FLAG="--with-postgresql"; fi; \
./configure --${BUILD_MODE} ${PG_FLAG}; \
cmake --build cmake-build-${BUILD_MODE} --parallel $(nproc); \
cmake --install cmake-build-${BUILD_MODE}; \
rm -rf cmake-build-${BUILD_MODE} src
# ─────────────────────────────────────────────────────────────────────────────
FROM debian:bookworm-slim AS app
ARG PROJECT_NAME=cs
ENV PROJECT_NAME="${PROJECT_NAME}"
RUN set -eux; \
apt-get update && apt-get install -y --no-install-recommends \
bash ca-certificates locales libpq5 && \
sed -i 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen && \
locale-gen && \
rm -rf /var/lib/apt/lists/*
ENV LANG=en_US.UTF-8
RUN mkdir -p /var/log/${PROJECT_NAME}
COPY --from=builder /usr/sbin/${PROJECT_NAME} /usr/sbin/${PROJECT_NAME}
COPY --from=builder /etc/${PROJECT_NAME} /etc/${PROJECT_NAME}
EXPOSE 9220
CMD ["/usr/sbin/cs"]
STOPSIGNAL SIGTERM