generated from steadybit/extension-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (40 loc) · 1.38 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1
##
## Build
##
FROM --platform=$BUILDPLATFORM golang:1.23-bookworm AS build
ARG TARGETOS TARGETARCH
ARG BUILD_WITH_COVERAGE
ARG BUILD_SNAPSHOT=true
ARG SKIP_LICENSES_REPORT=false
WORKDIR /app
RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' > /etc/apt/sources.list.d/goreleaser.list \
&& apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends build-essential libcap2-bin goreleaser
COPY . .
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH goreleaser build --snapshot="${BUILD_SNAPSHOT}" --single-target -o extension \
&& setcap "cap_setuid,cap_setgid,cap_sys_admin,cap_dac_override+eip" ./extension
##
## Runtime
##
FROM debian:bookworm-slim
LABEL "steadybit.com.discovery-disabled"="true"
ARG USERNAME=steadybit
ARG USER_UID=10000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
RUN apt-get -qq update \
&& apt-get -qq upgrade -y \
&& apt-get -y autoremove \
&& apt-get -qq install -y --no-install-recommends runc procps \
&& apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/*
USER $USERNAME
WORKDIR /
COPY --from=build /app/extension /extension
COPY --from=build /app/licenses /licenses
COPY javaagents/download/target/javaagent /javaagent
ENV STEADYBIT_EXTENSION_JAVA_AGENT_PATH=/javaagent
EXPOSE 8085 8081
ENTRYPOINT ["/extension"]