mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-07-11 09:29:28 +00:00
Add api build and clean to makefile (files restructure) (#9)
* no message * add clean api command
This commit is contained in:
26
api/Dockerfile
Normal file
26
api/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
FROM golang:1.16-alpine AS builder
|
||||
|
||||
# Move to working directory (/build).
|
||||
WORKDIR /build
|
||||
|
||||
# Copy and download dependency using go mod.
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy the code into the container.
|
||||
COPY . .
|
||||
|
||||
# Set necessary environmet variables needed for our image and build the API server.
|
||||
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
|
||||
RUN go build -ldflags="-s -w" -o apiserver .
|
||||
|
||||
FROM scratch
|
||||
|
||||
# Copy binary and config files from /build to root folder of scratch container.
|
||||
COPY --from=builder ["/build/apiserver", "/"]
|
||||
|
||||
# Export necessary port.
|
||||
EXPOSE 5000
|
||||
|
||||
# Command to run when starting the container.
|
||||
ENTRYPOINT ["/apiserver"]
|
||||
Reference in New Issue
Block a user