forked from ps2zhuantou/mosdns-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (39 loc) · 1.33 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
40
41
42
43
44
45
46
FROM --platform=${TARGETPLATFORM} golang:alpine as builder
ARG CGO_ENABLED=0
ARG TAG
ARG REPOSITORY
WORKDIR /root
RUN apk add --update git \
&& git clone https://github.com/${REPOSITORY} mosdns \
&& cd ./mosdns \
&& git fetch --all --tags \
&& git checkout tags/${TAG} \
&& go build -ldflags "-s -w -X main.version=${TAG}" -trimpath -o mosdns
FROM --platform=${TARGETPLATFORM} alpine:latest
LABEL maintainer="fordes123 <github.com/fordes123>"
ENV TZ=Asia/Shanghai \
CRON="0 0 */7 * *"
USER root
WORKDIR /etc/mosdns
COPY --from=builder /root/mosdns/mosdns /usr/bin/
COPY scripts /scripts
COPY config/* /etc/mosdns/
RUN apk add --no-cache ca-certificates wget dcron tzdata bash curl git \
&& cd /tmp && git clone https://github.com/systemd/systemd \
&& echo "unicode=\"YES\"" >> /etc/rc.conf && \
apk add --no-cache --virtual .build_deps \
autoconf file g++ gcc libc-dev make pkgconf python3 ninja \
util-linux pciutils usbutils coreutils binutils findutils grep \
build-base gcc abuild binutils binutils-doc gcc-doc gperf libcap libcap-dev \
valgrind-dev \
&& \
pip install meson
RUN cd /tmp/systemd && \
meson build && \
ninja build \
&& chmod a+x /scripts/* \
&& /scripts/update.sh \
&& /scripts/install-xray.sh > xray.log || cat xray.log
VOLUME /etc/mosdns
EXPOSE 53/udp 53/tcp
ENTRYPOINT [ "/scripts/entrypoint.sh" ]