-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
27 lines (20 loc) · 886 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
FROM --platform=$BUILDPLATFORM golang:alpine as builder
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETOS
ENV GOARCH=${TARGETARCH} GOOS=${TARGETOS}
WORKDIR /go/src/github.com/wish/katalog-sync
# Cache dependencies
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . /go/src/github.com/wish/katalog-sync
RUN cd /go/src/github.com/wish/katalog-sync/cmd/katalog-sync-daemon && CGO_ENABLED=0 go build
RUN cd /go/src/github.com/wish/katalog-sync/cmd/katalog-sync-sidecar && CGO_ENABLED=0 go build
FROM golang:alpine
COPY --from=builder /go/src/github.com/wish/katalog-sync/cmd/katalog-sync-daemon/katalog-sync-daemon /bin/katalog-sync-daemon
COPY --from=builder /go/src/github.com/wish/katalog-sync/cmd/katalog-sync-sidecar/katalog-sync-sidecar /bin/katalog-sync-sidecar
ARG USER=katalog-sync
ENV HOME /home/$USER
RUN addgroup -S $USER && adduser -S -G $USER -u 12345 $USER
USER $USER