-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (27 loc) · 1.26 KB
/
Dockerfile
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
FROM golang:1 AS builder
LABEL maintainers="Josh Ghiloni <[email protected]>"
ARG VERSION="0.0.0-dev"
ENV CGO_ENABLED 0
COPY . /builddir
WORKDIR /builddir
RUN go mod download
RUN go build -trimpath -ldflags "-X github.com/vmware-tanzu/observability-event-resource.AppVersion=${VERSION}" -o /assets/out ./cmd/out
RUN go build -trimpath -ldflags "-X github.com/vmware-tanzu/observability-event-resource.AppVersion=${VERSION}" -o /assets/in ./cmd/in
RUN go build -trimpath -ldflags "-X github.com/vmware-tanzu/observability-event-resource.AppVersion=${VERSION}" -o /assets/check ./cmd/check
RUN go build -trimpath -ldflags "-X github.com/vmware-tanzu/observability-event-resource.AppVersion=${VERSION}" -o /assets/version ./cmd/version
RUN set -e; for pkg in $(go list ./...); do \
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
done
FROM ubuntu:bionic AS resource
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates
FROM resource AS tests
COPY --from=builder /tests /tests
RUN set -e; for test in /tests/*.test; do \
$test; \
done
FROM scratch
COPY --from=builder /assets /opt/resource
COPY --from=resource /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=resource /etc/passwd /etc
COPY --from=resource /etc/shadow /etc