-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-compile-arm
36 lines (29 loc) · 1.05 KB
/
Dockerfile-compile-arm
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
FROM rust:1.80-slim
WORKDIR /app
RUN apt-get update
RUN apt-get install -y --no-install-recommends g++-aarch64-linux-gnu libc6-dev-arm64-cross
RUN rustup target add aarch64-unknown-linux-gnu
ARG CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
RUN mkdir -p /app/src
RUN echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs
COPY ./Cargo.toml ./
COPY ./Cargo.lock ./
COPY ./benches ./benches
RUN cargo fetch
RUN cargo build --target=aarch64-unknown-linux-gnu --release
COPY ./src ./src
RUN cargo build --target=aarch64-unknown-linux-gnu --release
FROM arm64v8/debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& update-ca-certificates \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
WORKDIR /app
RUN mkdir -p /app/target/release
COPY ./static ./static
COPY ./1hosts_pro.txt ./
COPY --from=0 /app/target/aarch64-unknown-linux-gnu/release/dns /app/target/release/
EXPOSE 53/udp
ENTRYPOINT ["./target/release/dns"]