forked from litmuschaos/chaos-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
28 lines (19 loc) · 752 Bytes
/
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
# Multi-stage docker build
# Build stage
FROM golang:alpine AS builder
LABEL maintainer="LitmusChaos"
ARG TARGETPLATFORM
ADD . /chaos-exporter
WORKDIR /chaos-exporter
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
RUN go env
RUN CGO_ENABLED=0 go build -buildvcs=false -o /output/chaos-exporter -v ./cmd/exporter/
# Packaging stage
# Image source: https://github.com/litmuschaos/test-tools/blob/master/custom/hardened-alpine/infra/Dockerfile
# The base image is non-root (have litmus user) with default litmus directory.
FROM litmuschaos/infra-alpine
LABEL maintainer="LitmusChaos"
COPY --from=builder /output/chaos-exporter /litmus
CMD ["./chaos-exporter"]
EXPOSE 8080