forked from PikuZheng/smartdns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
22 lines (21 loc) · 966 Bytes
/
Dockerfile.alpine
File metadata and controls
22 lines (21 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM --platform=$TARGETPLATFORM alpine:3.23 as smartdns-builder
# alpine 3.23 自带openssl 3.5.4
LABEL previous-stage=smartdns
# 添加标签,镜像生成后可使用 docker rmi `docker images --filter label=previous-stage=smartdns -q` 删除中间层
COPY . /smartdns/
RUN apk update && \
apk add make gcc build-base linux-headers openssl-dev openssl-libs-static && \
chmod -R 0755 /smartdns && \
cd /smartdns && \
sh ./package/build-pkg.sh --platform linux --arch `uname -m` --static && \
strip /smartdns/src/smartdns && \
mkdir -p /release/usr/sbin/ && \
mkdir -p /release/etc/smartdns/ && \
cp /smartdns/src/smartdns /release/usr/sbin/
FROM --platform=$TARGETPLATFORM alpine:3.23
ENV TZ="Asia/Shanghai"
COPY --from=smartdns-builder /release/ /
EXPOSE 53/udp 53/tcp
VOLUME "/etc/smartdns/"
HEALTHCHECK --interval=5m CMD test `nslookup dns.pub 127.0.0.1 |grep answer |wc -l` -gt 0
CMD ["/usr/sbin/smartdns", "-f", "-x", "-p -"]