working base

This commit is contained in:
Michal Humpula
2025-03-16 10:20:48 +01:00
parent 0ddf5f1c36
commit 5fbd72b370
19 changed files with 3261 additions and 0 deletions

31
Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
FROM rust:1.93-alpine AS builder
RUN apk add --no-cache musl-dev
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
# Create dummy main.rs to cache dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release && rm -rf src
COPY src ./src
RUN cargo build --release
FROM alpine:latest
RUN apk add --no-cache iputils iptables
WORKDIR /app
COPY --from=builder /app/target/release/route-switcher .
ENV RUST_LOG=info
ENV PRIMARY_INTERFACE=eth0
ENV SECONDARY_INTERFACE=eth1
ENV PRIMARY_GATEWAY=192.168.1.1
ENV SECONDARY_GATEWAY=192.168.2.1
ENV PING_TARGET=8.8.8.8
CMD ["./route-switcher"]