-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile.alpine
40 lines (32 loc) · 1.34 KB
/
Dockerfile.alpine
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
FROM golang:1.22-alpine AS builder
MAINTAINER Ugo Landini <ugo@confluent.io>
ARG VERSION=0.4.0
ARG GOVERSION=$(go version)
ARG USER=$(id -u -n)
ARG TIME=$(date)
RUN apk update \
&& apk add --no-cache git \
&& apk add --no-cache ca-certificates \
&& apk add --update gcc musl-dev libssl3\
&& update-ca-certificates
RUN adduser \
--disabled-password \
--gecos "" \
--home "/home/jr" \
--shell "/bin/sh" \
--uid "100001" \
"jr-user"
WORKDIR /go/src/github.com/jrnd-io/jr
COPY . .
RUN go get -u -d -v
RUN CGO_ENABLED=1 GOOS=linux go build -tags musl -v -ldflags="-X 'github.com/jrnd-io/jr/cmd.Version=${VERSION}' 'github.com/jrnd-io/jr/pkg/cmd.GoVersion=${GOVERSION}' -X 'github.com/jrnd-io/jr/cmd.BuildUser=${USER}' -X 'github.com/jrnd-io/jr/cmd.BuildTime=${TIME}'" -o build/jr jr.go
FROM alpine
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/jrnd-io/jr/templates/ /home/jr/.jr/templates/
COPY --from=builder /go/src/github.com/jrnd-io/jr/config/ /home/jr/.jr/
COPY --from=builder /go/src/github.com/jrnd-io/jr/pkg/producers/kafka/*.examples /home/jr/.jr/kafka/
COPY --from=builder /go/src/github.com/jrnd-io/jr/build/jr /bin
USER jr-user:jr-user
ENV JR_SYSTEM_DIR=/home/jr/.jr