-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile.acceptance-testing
29 lines (26 loc) · 1.08 KB
/
Dockerfile.acceptance-testing
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
FROM golang:1.22.5-alpine3.19 as builder
WORKDIR /go/src/github.com/mendersoftware/useradm
RUN mkdir -p /etc_extra
RUN echo "nobody:x:65534:" > /etc_extra/group
RUN echo "nobody:!::0:::::" > /etc_extra/shadow
RUN echo "nobody:x:65534:65534:Nobody:/:" > /etc_extra/passwd
RUN chown -R nobody:nobody /etc_extra
RUN mkdir /tmp/gocovedir
COPY ./ .
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=cache,target=/root/.cache/go-build \
env CGO_ENABLED=0 go test -c -o useradm \
-tags main -cover -covermode=atomic \
-coverpkg $(go list ./... | grep -v vendor | grep -v mock | grep -v test | tr '\n' ,)
FROM scratch
EXPOSE 8080
COPY --from=builder /etc_extra/ /etc/
USER 65534
WORKDIR /etc/useradm/rsa
COPY --chown=nobody ./config.yaml /etc/useradm/
COPY --chown=nobody ./config/plans.yaml /etc/useradm/
COPY --from=builder --chown=nobody /go/src/github.com/mendersoftware/useradm/useradm /usr/bin/
COPY --from=builder --chown=nobody /tmp/gocovedir /tmp/gocovedir
ENV GOCOVERDIR=/tmp/gocovedir
ENTRYPOINT ["/usr/bin/useradm", "--config", "/etc/useradm/config.yaml"]
STOPSIGNAL SIGINT