Files
kubeshark/api/Dockerfile
RamiBerm 175175e5ee Merge branch 'develop'
Conflicts:
	api/Dockerfile
2021-04-28 17:50:52 +03:00

39 lines
1.0 KiB
Docker

FROM golang:1.16-alpine AS builder
# Set necessary environment variables needed for our image.
ENV CGO_ENABLED=1 GOOS=linux GOARCH=amd64
RUN apk add libpcap-dev gcc g++ make
# Move to tapper working directory (/tap-build).
WORKDIR /tap-build
COPY tap/go.mod tap/go.sum ./
RUN go mod download
# Copy and build tapper code
COPY tap/src ./
RUN go build -ldflags="-s -w" -o passivetapper .
# Move to api working directory (/api-build).
WORKDIR ../api-build
COPY go.mod go.sum ./
RUN go mod download
# Copy and build api code
COPY . .
RUN go build -ldflags="-s -w" -o apiserver .
FROM alpine:3.13.5
RUN apk add bash libpcap-dev
WORKDIR /app
# Copy binary and config files from /build to root folder of scratch container.
COPY --from=builder ["/api-build/apiserver", "."]
COPY --from=builder ["/tap-build/passivetapper", "."]
COPY scripts/multi-runner.sh ./
# this script runs both apiserver and passivetapper and exits either if one of them exits, preventing a scenario where the container runs without one process
CMD "./multi-runner.sh"