A very performant and light (2mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres/SQLite.
1# Build stage 2FROM rust:latest as builder 3 4# Install PostgreSQL client libraries and SSL dependencies 5RUN apt-get update && \ 6 apt-get install -y pkg-config libssl-dev libpq-dev && \ 7 rm -rf /var/lib/apt/lists/* 8 9WORKDIR /usr/src/app 10 11# Copy manifests first (better layer caching) 12COPY Cargo.toml Cargo.lock ./ 13 14# Copy source code and SQLx prepared queries 15COPY src/ src/ 16COPY migrations/ migrations/ 17COPY .sqlx/ .sqlx/ 18 19# Build your application 20RUN cargo build --release 21 22# Runtime stage 23FROM debian:bookworm-slim 24 25# Install runtime dependencies 26RUN apt-get update && \ 27 apt-get install -y libpq5 ca-certificates openssl libssl3 && \ 28 rm -rf /var/lib/apt/lists/* 29 30WORKDIR /app 31 32# Copy the binary from builder 33COPY --from=builder /usr/src/app/target/release/simplelink /app/simplelink 34# Copy migrations folder for SQLx 35COPY --from=builder /usr/src/app/migrations /app/migrations 36 37# Expose the port (this is just documentation) 38EXPOSE 8080 39 40# Set default network configuration 41ENV SERVER_HOST=0.0.0.0 42ENV SERVER_PORT=8080 43 44# Run the binary 45CMD ["./simplelink"]