-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.coverage
42 lines (29 loc) · 976 Bytes
/
Dockerfile.coverage
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
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM golang:1.13.6-alpine AS build
RUN apk add --no-cache git
WORKDIR /rks/
COPY go.mod ./go.mod
COPY go.sum ./go.sum
# Install dependencies before copying code and benefit from docker caching
RUN go mod download
COPY ./cmd ./cmd
COPY ./pkg ./pkg
ENV CGO_ENABLED=0
# !!! Instrument binary with coverage probes
# !!! On exit, the binary will leave a coverage file
# !!! At -test.coverprofile /path/to/coverage/file
RUN go test -c -covermode=count -o bin/rks -coverpkg=./... ./cmd/remote-key-server/
FROM alpine:3.11.2 AS runtime
LABEL name="RKS Server" \
description="Remote Key Server image" \
url="https://github.com/Orange-OpenSource/remote-key-server" \
maintainer="[email protected]"
WORKDIR /rks/
RUN addgroup -g 1000 -S rks && \
adduser -u 1000 -S rks -G rks
RUN mkdir /rks/report && chown -R rks:rks /rks/
USER rks
COPY --from=build /rks/bin/rks ./rks
COPY certs ./certs/
VOLUME /rks/report
EXPOSE 8080/tcp
ENTRYPOINT ["./rks"]