Skip to content

Commit

Permalink
Set unprivileged user to container image
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
  • Loading branch information
jpkrohling committed Mar 30, 2021
1 parent 791c7f9 commit c78c3fd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
6 changes: 5 additions & 1 deletion cmd/otelcontribcol/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ FROM alpine:latest as certs
RUN apk --update add ca-certificates

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY otelcontribcol /
EXPOSE 55680 55679
EXPOSE 4317 55680 55679
ENTRYPOINT ["/otelcontribcol"]
CMD ["--config", "/etc/otel/config.yaml"]
8 changes: 6 additions & 2 deletions examples/tracing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14 AS build
FROM golang:1.16 AS build

WORKDIR /src
ADD . /src
Expand All @@ -9,7 +9,11 @@ FROM alpine:latest as certs
RUN apk --update add ca-certificates

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /src/bin/otelcontribcol_linux_amd64 /otelcontribcol
ENTRYPOINT ["/otelcontribcol"]
EXPOSE 55680 55679
EXPOSE 4317 55680 55679
8 changes: 6 additions & 2 deletions exporter/loadbalancingexporter/example/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14 AS build
FROM golang:1.16 AS build

WORKDIR /src
ADD . /src
Expand All @@ -9,7 +9,11 @@ FROM alpine:latest as certs
RUN apk --update add ca-certificates

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /src/bin/otelcontribcol_linux_amd64 /otelcontribcol
ENTRYPOINT ["/otelcontribcol"]
EXPOSE 55680 55679
EXPOSE 4317 55680 55679
8 changes: 6 additions & 2 deletions exporter/lokiexporter/example/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14 AS build
FROM golang:1.16 AS build

WORKDIR /src
ADD . /src
Expand All @@ -9,7 +9,11 @@ FROM alpine:latest as certs
RUN apk --update add ca-certificates

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /src/bin/otelcontribcol_linux_amd64 /otelcontribcol
ENTRYPOINT ["/otelcontribcol"]
EXPOSE 55680 55679
EXPOSE 4317 55680 55679
8 changes: 6 additions & 2 deletions exporter/splunkhecexporter/example/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14 AS build
FROM golang:1.16 AS build

WORKDIR /src
ADD . /src
Expand All @@ -9,7 +9,11 @@ FROM alpine:latest as certs
RUN apk --update add ca-certificates

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /src/bin/otelcontribcol_linux_amd64 /otelcontribcol
ENTRYPOINT ["/otelcontribcol"]
EXPOSE 55680 55679
EXPOSE 4317 55680 55679
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14-stretch
FROM golang:1.16-stretch

WORKDIR /go/src/app

Expand Down

0 comments on commit c78c3fd

Please sign in to comment.