forked from IBM/varnish-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (31 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
48 lines (31 loc) · 1.09 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
FROM golang:1.15-buster AS builder
ENV DEBIAN_FRONTEND=noninteractive INSTALL_DIRECTORY=/usr/local/bin
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /go/src/github.com/ibm/varnish-operator
ENV GOPROXY=https://proxy.golang.org
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ cmd/
COPY pkg/ pkg/
COPY api/ api/
ARG VERSION=undefined
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build \
-ldflags "-X main.Version=$VERSION" \
-a \
-o varnish-operator \
github.com/ibm/varnish-operator/cmd/varnish-operator
FROM debian:buster-slim
LABEL maintainer="Alex Lytvynenko <oleksandr.lytvynenko@ibm.com>, Tomash Sidei <tomash.sidei@ibm.com>"
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /
RUN apt-get update && apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
RUN addgroup --gid 901 varnish-operator && adduser --uid 901 --gid 901 varnish-operator
COPY --from=builder /go/src/github.com/ibm/varnish-operator/varnish-operator .
USER varnish-operator
ENTRYPOINT ["/varnish-operator"]