k8s integration
This commit is contained in:
40
Dockerfile
40
Dockerfile
@@ -1,21 +1,43 @@
|
||||
FROM golang:alpine as builder
|
||||
FROM golang:alpine AS deps
|
||||
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN sed -i '/replace/d' go.mod
|
||||
RUN go mod download
|
||||
|
||||
#----------------------------------------------------------------------------------------------
|
||||
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN apk add git
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" .
|
||||
RUN go install github.com/beego/bee/v2@latest
|
||||
|
||||
RUN ls /app
|
||||
WORKDIR /oc-aggregator
|
||||
|
||||
FROM scratch
|
||||
COPY --from=deps /go/pkg /go/pkg
|
||||
COPY --from=deps /app/go.mod /app/go.sum ./
|
||||
|
||||
RUN export CGO_ENABLED=0 && \
|
||||
export GOOS=linux && \
|
||||
export GOARCH=amd64 && \
|
||||
export BUILD_FLAGS="-ldflags='-w -s'"
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN sed -i '/replace/d' go.mod
|
||||
RUN bee pack
|
||||
RUN mkdir -p /app/extracted && tar -zxvf oc-aggregator.tar.gz -C /app/extracted
|
||||
|
||||
#----------------------------------------------------------------------------------------------
|
||||
|
||||
FROM golang:alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/oc-discovery /usr/bin/
|
||||
COPY docker_aggregator.json /etc/oc/aggregator.json
|
||||
COPY --from=builder /app/extracted/oc-aggregator /usr/bin/
|
||||
COPY --from=builder /app/extracted/aggregator.json /etc/oc/aggregator.json
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
|
||||
Reference in New Issue
Block a user