-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathDockerfile
39 lines (27 loc) · 1.25 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
FROM golang:1.22 AS build
ENV CGO_ENABLED=0
ENV GOOS=linux
RUN useradd -u 10001 connect
WORKDIR /go/src/github.com/redpanda-data/redpanda-connect-plugin-example/
# Update dependencies: On unchanged dependencies, cached layer will be reused
COPY go.* /go/src/github.com/redpanda-data/redpanda-connect-plugin-example/
RUN go mod download
# Build
COPY . /go/src/github.com/redpanda-data/redpanda-connect-plugin-example/
# Tag timetzdata required for busybox base image:
# https://github.com/redpanda-data/connect/issues/897
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod go build -tags timetzdata -ldflags="-w -s" -o redpanda-connect-plugin-example
# Pack
FROM busybox AS package
LABEL maintainer="Ashley Jeffs <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/redpanda-data/redpanda-connect-plugin-example"
WORKDIR /
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /etc/passwd /etc/passwd
COPY --from=build /go/src/github.com/redpanda-data/redpanda-connect-plugin-example/redpanda-connect-plugin-example .
COPY ./config/example_1.yaml /connect.yaml
USER connect
EXPOSE 4195
ENTRYPOINT ["/redpanda-connect-plugin-example"]
CMD ["-c", "/connect.yaml"]