-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
48 lines (34 loc) · 1.23 KB
/
dockerfile
File metadata and controls
48 lines (34 loc) · 1.23 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
# Этап 1: сборка
FROM ubuntu:24.04 AS builder
LABEL stage=builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY CMakeLists.txt .
COPY src/ ./src/
COPY tests/ ./tests/
RUN mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF && \
make -j$(nproc)
# Этап 2: минимальный финальный образ
FROM ubuntu:24.04
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION=1.0.0
LABEL org.opencontainers.image.title="System Monitor" \
org.opencontainers.image.description="Linux system resource monitor" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.source="https://github.com/cpprismic/github-actions-demo"
RUN useradd -r -s /bin/false monitor
COPY --from=builder /app/build/bin/system_monitor /usr/local/bin/
USER monitor
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD /usr/local/bin/system_monitor
ENTRYPOINT ["/usr/local/bin/system_monitor"]
CMD []