expose port and drop to nobody user in go example
This commit is contained in:
parent
e491f8d6ad
commit
6a5d7ba797
|
@ -1,9 +1,17 @@
|
|||
ARG GO_IMAGE=ocirep:go
|
||||
FROM ${GO_IMAGE} as build
|
||||
COPY . .
|
||||
RUN cargo build main.go
|
||||
RUN go build main.go
|
||||
|
||||
RUN mkdir -p rootfs/etc \
|
||||
&& echo "nogroup:*:100:nobody" > ~/rootfs/etc/group \
|
||||
&& echo "nobody:*:100:100:::" > ~/rootfs/etc/passwd \
|
||||
&& cp main rootfs/
|
||||
|
||||
ARG CA_IMAGE=ocirep:ca-certificates
|
||||
FROM scratch
|
||||
COPY --from=${CA_IMAGE} /
|
||||
COPY --from=build main .
|
||||
COPY --from=build --chown=100:100 rootfs /
|
||||
USER 100:100
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT main
|
||||
|
|
Reference in New Issue