-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
54 lines (38 loc) · 1.73 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
47
48
49
50
51
52
53
54
FROM ubuntu:24.04 AS base
SHELL ["/bin/sh", "-x", "-c"]
ENV SERIAL=2
########################################
FROM base AS builder
ARG CFLAGS=-Ofast
ARG BUILD_DEPS="curl make ca-certificates build-essential pkg-config libssl-dev libclang-dev cmake"
WORKDIR /tmp
COPY . /tmp/
ARG RUSTFLAGS="-C link-arg=-s"
RUN update-ca-certificates 2> /dev/null || true
RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS && \
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable && \
export PATH="$HOME/.cargo/bin:$PATH" && \
echo "Building DoH Auth Proxy from source" && \
cargo build --release --no-default-features --package doh-auth-proxy && \
mkdir -p /opt/doh-auth-proxy/sbin && \
strip --strip-all /tmp/target/release/doh-auth-proxy
########################################
FROM base AS runner
LABEL maintainer="Jun Kurihara"
ARG RUNTIME_DEPS="logrotate ca-certificates gosu"
RUN apt-get update && \
apt-get install -qy --no-install-recommends $RUNTIME_DEPS && \
apt-get -qy clean && \
rm -fr /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/* /var/log/apt/* /var/log/*.log &&\
find / -type d -path /proc -prune -o -type f -perm /u+s -ignore_readdir_race -exec chmod u-s {} \; && \
find / -type d -path /proc -prune -o -type f -perm /g+s -ignore_readdir_race -exec chmod g-s {} \; && \
mkdir -p /modoh/bin &&\
mkdir -p /modoh/log
COPY --from=builder /tmp/target/release/doh-auth-proxy /modoh/bin/doh-auth-proxy
COPY ./docker/run.sh /modoh
COPY ./docker/entrypoint.sh /modoh
RUN chmod +x /modoh/run.sh && \
chmod +x /modoh/entrypoint.sh
EXPOSE 53/udp 53/tcp
CMD ["/usr/bin/bash", "/modoh/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/bash", "/modoh/entrypoint.sh"]