Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Rust

on: [push]

jobs:
build:
name: Test-Clippy-Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
name: Checkout code
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
name: Install toolchain
with:
toolchain: stable
- uses: actions-rs/cargo@v1
name: Check formatting
with:
command: fmt
args: -- --check
- uses: actions-rs/cargo@v1
name: Run clippy
with:
command: clippy

- uses: actions-rs/cargo@v1
name: Run tests
with:
command: test

- uses: actions-rs/cargo@v1
name: Build
with:
toolchain: stable
command: build
args: --release
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target
query_packet.txt
response_packet.txt
.vscode
Authoritative-DNS-server.png
237 changes: 237 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "dnsserver-nabil"
version = "0.1.0"
edition = "2021"

[dependencies]
clap = { version = "4.5.23", features = ["derive"] }

[profile.release]
target = "x86_64-unknown-linux-musl"
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Stage 1: Build Stage
FROM rust:slim as builder

RUN rustup target add x86_64-unknown-linux-musl
RUN apt-get update && apt-get install -y musl-tools

WORKDIR /src

COPY . /src

RUN cargo build --release --target x86_64-unknown-linux-musl

FROM alpine:3.19

WORKDIR /app

COPY --from=builder /src/target/x86_64-unknown-linux-musl/release/dnsserver-nabil /app/dnsserver-nabil

# Ensure the binary is executable
RUN chmod +x /app/dnsserver-nabil

EXPOSE 2053/udp

CMD ["./dnsserver-nabil"]
Loading