waitup 1.0.0

Wait for TCP ports and HTTP endpoints to be available. Essential for Docker, K8s, and CI/CD pipelines to ensure services are ready before proceeding.
Documentation
# Alpine-based Dockerfile for even smaller images
# This creates a very minimal container (~10MB)

# Build stage
FROM rust:1.83-alpine AS builder

# Install build dependencies
RUN apk add --no-cache \
    musl-dev \
    pkgconfig \
    openssl-dev \
    openssl-libs-static

# Set up architecture-specific variables
ARG TARGETARCH
RUN case ${TARGETARCH} in \
    "amd64") echo "x86_64-unknown-linux-musl" > /tmp/target ;; \
    "arm64") echo "aarch64-unknown-linux-musl" > /tmp/target ;; \
    *) echo "x86_64-unknown-linux-musl" > /tmp/target ;; \
    esac

# Install rust target for the architecture
RUN rustup target add $(cat /tmp/target)

# Create a new empty shell project
RUN USER=root cargo new --bin waitup
WORKDIR /waitup

# Copy manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml

# Build dependencies - this is the caching Docker layer!
RUN cargo build --release && rm src/*.rs

# Copy source code
COPY ./src ./src

# Build for release with static linking
ENV RUSTFLAGS="-C target-feature=+crt-static"
RUN rm ./target/release/deps/waitup*
RUN TARGET=$(cat /tmp/target) && cargo build --release --target $TARGET
RUN TARGET=$(cat /tmp/target) && cp /waitup/target/$TARGET/release/waitup /waitup-binary

# Runtime stage - minimal scratch image
FROM scratch

# Copy CA certificates
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Copy the binary from the build stage
COPY --from=builder /waitup-binary /waitup

# Set the binary as the entrypoint
ENTRYPOINT ["/waitup"]

# Default command
CMD ["--help"]

# Metadata
LABEL org.opencontainers.image.title="waitup"
LABEL org.opencontainers.image.description="A robust CLI tool for waiting until TCP ports, HTTP endpoints, and services become available (Alpine/Minimal)"
LABEL org.opencontainers.image.version="1.0.0"
LABEL org.opencontainers.image.authors="Serhii Kaliuzhnyi <kalyuzhni.sergei@gmail.com>"
LABEL org.opencontainers.image.url="https://github.com/grok-rs/waitup"
LABEL org.opencontainers.image.source="https://github.com/grok-rs/waitup"
LABEL org.opencontainers.image.vendor="waitup"
LABEL org.opencontainers.image.licenses="MIT"