Add Rust port of the finger daemon
CI / Build and Test (gcc, g++, ubuntu-latest) (push) Failing after 31s
CI / Code Coverage (push) Skipped
Build and Publish Docker Image / build-and-test (push) Failing after 1m7s
Build and Publish Docker Image / build-and-push-image (push) Skipped
Build and Publish Docker Image / security-scan (push) Skipped
CI / Build and Test (gcc, g++, ubuntu-latest) (push) Failing after 31s
CI / Code Coverage (push) Skipped
Build and Publish Docker Image / build-and-test (push) Failing after 1m7s
Build and Publish Docker Image / build-and-push-image (push) Skipped
Build and Publish Docker Image / security-scan (push) Skipped
Tokio-based reimplementation in rust/, mirroring the C++ handler and ban-tracker logic (directory-traversal checks, case-insensitive plan lookup, rolling-window IP ban tracking, allowlist parsing) along with its full test suite. Includes a matching multi-stage Dockerfile.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# Multi-stage build for the Rust finger service
|
||||
# Build stage
|
||||
FROM rust:slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --release
|
||||
RUN cargo test --release
|
||||
|
||||
# Runtime stage — match the C++ image's base so OS-level overhead (syscalls,
|
||||
# libc) is comparable between the two for benchmarking.
|
||||
FROM ubuntu:24.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
netcat-openbsd \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& (userdel -r ubuntu 2>/dev/null || true) \
|
||||
&& groupadd -g 1000 finger \
|
||||
&& useradd -m -u 1000 -g finger -s /bin/sh finger
|
||||
|
||||
COPY --from=builder /app/target/release/finger /usr/local/bin/finger
|
||||
RUN chmod +x /usr/local/bin/finger
|
||||
|
||||
RUN mkdir -p /var/finger/users && \
|
||||
chown -R finger:finger /var/finger
|
||||
|
||||
USER finger
|
||||
|
||||
EXPOSE 79
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD nc -w 1 127.0.0.1 79 < /dev/null || exit 1
|
||||
|
||||
LABEL org.opencontainers.image.title="finger"
|
||||
LABEL org.opencontainers.image.description="A silly finger service written in Rust"
|
||||
LABEL org.opencontainers.image.source="https://github.com/waffle2k/finger"
|
||||
LABEL org.opencontainers.image.licenses="MIT"
|
||||
|
||||
CMD ["finger"]
|
||||
Reference in New Issue
Block a user