working base
This commit is contained in:
31
Dockerfile
Normal file
31
Dockerfile
Normal 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"]
|
||||
Reference in New Issue
Block a user