Skip to content

Commit

Permalink
Merge pull request #14 from thibault-cne/issue/13
Browse files Browse the repository at this point in the history
Fixed the dockerfile
  • Loading branch information
thibault-cne authored Jul 29, 2024
2 parents 25bffc8 + 4f8d830 commit 65c9962
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM rust:alpine3.19 AS chef
FROM rust:alpine3.19 AS builder

ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN apk add --no-cache musl-dev

RUN cargo install cargo-chef

WORKDIR /usr

# Create the all architecture tree
Expand All @@ -14,24 +13,22 @@ WORKDIR /usr/dnsr
# Copy the Cargo.toml files
COPY Cargo.toml Cargo.toml

FROM chef AS planner

RUN cargo chef prepare --recipe-path recipe.json

FROM planner AS builder

COPY --from=planner /usr/dnsr/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# 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

Expand All @@ -40,6 +37,6 @@ LABEL org.opencontainers.image.source="https://github.com/thibault-cne/dnsr"

COPY --from=builder /usr/dnsr/target/release/dnsr /usr/local/bin

EXPOSE 8053
EXPOSE 8053/udp

ENTRYPOINT ["/usr/local/bin/dnsr"]

0 comments on commit 65c9962

Please sign in to comment.