-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
29 lines (26 loc) · 1.19 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
# syntax=docker/dockerfile:experimental
FROM golang:1.19 AS build-env
ENV GO111MODULE on
WORKDIR /
RUN git clone https://github.com/coredns/coredns && cd coredns && git checkout 7d5f5b87a4fb310d442f7ef0d52e3fead0e10d39
COPY . /k8s_dns_chaos
# RUN ln -s /k8s_dns_chaos /coredns/plugin/k8s_dns_chaos
RUN sed -i '/kubernetes/a\k8s_dns_chaos:github.com/chaos-mesh/k8s_dns_chaos' /coredns/plugin.cfg
RUN cd coredns && \
go mod edit -require github.com/chaos-mesh/[email protected] && \
go mod edit -replace github.com/chaos-mesh/k8s_dns_chaos=/k8s_dns_chaos && \
go mod edit -replace google.golang.org/grpc=google.golang.org/[email protected] && \
go get github.com/chaos-mesh/k8s_dns_chaos && \
go generate && \
go mod tidy
RUN cd coredns && make
FROM debian:stable-slim AS certs
RUN apt-get update && apt-get -uy upgrade
RUN apt-get -y install ca-certificates && update-ca-certificates
FROM scratch
LABEL org.opencontainers.image.source=https://github.com/chaos-mesh/k8s_dns_chaos
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
COPY --from=build-env /coredns/coredns /coredns
EXPOSE 53 53/udp
ENV GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn
ENTRYPOINT ["/coredns"]