Skip to content

Commit 1485768

Browse files
committed
Try using scratch image
This should reduce the image size a bit
1 parent 8563a90 commit 1485768

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Dockerfile

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
FROM ubuntu:20.04
1+
FROM golang:1.21-alpine AS builder
22

3-
RUN apt-get update && \
4-
apt-get install --no-install-recommends -y ca-certificates=20240203~20.04.1 && \
5-
mkdir -p /etc/kangal && \
6-
apt-get clean && \
7-
rm -rf /var/lib/apt/lists/*
3+
RUN apk --no-cache add ca-certificates=20241121-r1 && \
4+
update-ca-certificates
85

9-
COPY kangal /bin/kangal
10-
COPY openapi.json /etc/kangal/
6+
FROM scratch
7+
USER nobody
8+
# Use nobody user + group
9+
USER nobody:nobody
10+
# Copy nobody user
11+
COPY --from=builder /etc/passwd /etc/passwd
12+
COPY --from=builder /etc/group /etc/group
1113

12-
RUN chmod a+x /bin/kangal && \
13-
chmod -R a+r /etc/kangal
14+
COPY kangal /bin/kangal
1415

15-
# Use nobody user + group
16-
USER 65534:65534
16+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
1717

1818
EXPOSE 8080
1919
ENTRYPOINT ["/bin/kangal"]

0 commit comments

Comments
 (0)