-
Notifications
You must be signed in to change notification settings - Fork 46
/
Dockerfile.debian
85 lines (69 loc) · 2.81 KB
/
Dockerfile.debian
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# syntax = docker/dockerfile:1.0-experimental
ARG BUILD_IMAGE
FROM --platform=${BUILDPLATFORM} ${BUILD_IMAGE} as build
ENV _RJEM_MALLOC_CONF="narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0"
ENV JEMALLOC_SYS_WITH_MALLOC_CONF="narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0"
ARG FEATURES
ARG SCCACHE_BUCKET
ARG SCCACHE_REGION
ARG SCCACHE_ENDPOINT
ARG SCCACHE_SERVER_PORT=4226
ARG SCCACHE_RECACHE
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ENV RUST_LOG=rustc_codegen_ssa::back::link=info
# Create the directory for agent repo
WORKDIR /opt/logdna-agent-v2
# Add the actual agent source files
COPY . .
# Rebuild the agent
# hadolint ignore=SC1091
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \
--mount=type=cache,target=/opt/rust/cargo/registry \
--mount=type=cache,target=/opt/logdna-agent-v2/target \
set -a; \
if [ -z "$SCCACHE_BUCKET" ]; then unset RUSTC_WRAPPER; fi; \
if [ -z "$SCCACHE_ENDPOINT" ]; then unset SCCACHE_ENDPOINT; fi; \
if [ -z "$SCCACHE_RECACHE" ]; then unset SCCACHE_RECACHE; fi; \
set +a && env && \
export RUSTFLAGS=-g && \
cargo build --manifest-path bin/Cargo.toml ${FEATURES} --release && \
cp ./target/release/logdna-agent /logdna-agent && \
sccache --show-stats
# Use Debian as agent base image
FROM debian:bullseye
ARG REPO
ARG BUILD_TIMESTAMP
ARG VCS_REF
ARG VCS_URL
ARG BUILD_VERSION
LABEL org.opencontainers.image.created="${BUILD_TIMESTAMP}"
LABEL org.opencontainers.image.authors="LogDNA <[email protected]>"
LABEL org.opencontainers.image.url="https://logdna.com"
LABEL org.opencontainers.image.documentation=""
LABEL org.opencontainers.image.source="${VCS_URL}"
LABEL org.opencontainers.image.version="${BUILD_VERSION}"
LABEL org.opencontainers.image.revision="${VCS_REF}"
LABEL org.opencontainers.image.vendor="LogDNA Inc."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.ref.name=""
LABEL org.opencontainers.image.title="LogDNA Agent"
LABEL org.opencontainers.image.description="The blazingly fast, resource efficient log collection client"
ENV DEBIAN_FRONTEND=noninteractive
ENV _RJEM_MALLOC_CONF="narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0"
ENV JEMALLOC_SYS_WITH_MALLOC_CONF="narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0"
# Copy the agent binary from the build stage
COPY --from=build /logdna-agent /work/
WORKDIR /work/
RUN apt update -y \
&& apt upgrade -y \
&& apt auto-remove -y \
&& apt install -y --no-install-recommends ca-certificates libcap2-bin \
netcat-openbsd nmap dnsutils vim curl procps net-tools \
gdbserver \
&& rm -rf /var/cache/apt \
&& chmod -R 777 . \
&& setcap "cap_dac_read_search+p" /work/logdna-agent \
&& groupadd -g 5000 logdna \
&& useradd -u 5000 -g logdna logdna
CMD ["./logdna-agent"]