-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (26 loc) · 820 Bytes
/
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
FROM rust:alpine3.19 AS builder
ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN apk add --no-cache musl-dev
WORKDIR /usr
# Create the all architecture tree
RUN cargo new --bin dnsr
WORKDIR /usr/dnsr
# Copy the Cargo.toml files
COPY Cargo.toml Cargo.toml
# Compile the dependencies
RUN cargo build --release
RUN rm -rf src
COPY src src
# Build the project
RUN touch src/main.rs
RUN cargo build --release
RUN strip target/release/dnsr
FROM alpine:3.19 AS runtime
RUN apk add --no-cache libgcc
# Create the configuration directory
RUN mkdir -p /etc/dnsr
LABEL maintainer="Thibault C. <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/thibault-cne/dnsr"
COPY --from=builder /usr/dnsr/target/release/dnsr /usr/local/bin
EXPOSE 53/udp
ENTRYPOINT ["/usr/local/bin/dnsr"]