Skip to content

Commit f3e18d1

Browse files
committed
Set unprivileged user to container image
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
1 parent 2e2b338 commit f3e18d1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cmd/otelcol/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
FROM alpine:3.12 as certs
1+
FROM alpine:latest as certs
22
RUN apk --update add ca-certificates
33

4-
FROM alpine:3.12 AS otelcol
4+
FROM alpine:latest AS otelcol
55
COPY otelcol /
66
# Note that this shouldn't be necessary, but in some cases the file seems to be
77
# copied with the execute bit lost (see #1317)
88
RUN chmod 755 /otelcol
99

1010
FROM scratch
11+
12+
ARG USER_UID=10001
13+
USER ${USER_UID}
14+
1115
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
1216
COPY --from=otelcol /otelcol /
1317
COPY config.yaml /etc/otel/config.yaml
1418
ENTRYPOINT ["/otelcol"]
1519
CMD ["--config", "/etc/otel/config.yaml"]
16-
EXPOSE 55678 55679
20+
EXPOSE 4317 55678 55679

examples/demo/app/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
FROM golang:1.14
14+
FROM golang:1.16
1515
COPY . /usr/src/app/
1616
WORKDIR /usr/src/app/
1717
RUN go env -w GOPROXY=direct

0 commit comments

Comments
 (0)