-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (33 loc) · 822 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
43
44
45
## builder
FROM alpine:3.19 AS builder
WORKDIR /code/bancuh-dns
# install system dependencies
RUN apk add build-base \
cargo \
clang \
clang-dev \
clang-libs \
linux-headers \
rust
# setup build dependencies
RUN cargo init .
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release
RUN rm -rf ./src/
# copy code files
COPY /src/ ./src/
# build code
RUN touch ./src/main.rs
RUN cargo build --release
## runtime
FROM alpine:3.19 AS runtime
# install runtime dependencies
RUN apk add openssl bind libgcc libstdc++
# set default logging, can be overridden
ENV RUST_LOG=info
# copy bind config
COPY named.conf /etc/bind/named.conf
# copy binary
COPY --from=builder /code/bancuh-dns/target/release/bancuh-dns /usr/local/bin/bancuh-dns
# set entrypoint
ENTRYPOINT ["/usr/local/bin/bancuh-dns"]