Skip to content

Instantly share code, notes, and snippets.

@tilllt
Created October 8, 2025 20:46
Show Gist options
  • Select an option

  • Save tilllt/389082a15cf3ca7fcd0127579a0e71e5 to your computer and use it in GitHub Desktop.

Select an option

Save tilllt/389082a15cf3ca7fcd0127579a0e71e5 to your computer and use it in GitHub Desktop.
# Build stage - using nightly for edition2024 support
FROM rustlang/rust:nightly-alpine AS builder
# Install build dependencies
RUN apk add --no-cache \
musl-dev \
git \
pkgconfig \
openssl-dev \
openssl-libs-static \
ca-certificates
# Add musl target
RUN rustup target add x86_64-unknown-linux-musl
WORKDIR /build
# Clone the repo WITH submodules directly in Docker
RUN git clone --recurse-submodules https://github.com/martinbogo/meshbbs.git . && \
git checkout main
# Build fully static binary with musl
ENV RUSTFLAGS='-C target-feature=+crt-static -C link-arg=-static'
RUN cargo build --release --target x86_64-unknown-linux-musl
# Strip debug symbols to minimize size
RUN strip /build/target/x86_64-unknown-linux-musl/release/meshbbs
# Runtime stage - Alpine with shell for debugging
FROM alpine:latest
# Install runtime essentials including shell
RUN apk add --no-cache \
libgcc \
ca-certificates \
bash \
coreutils
# Copy the static binary
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/meshbbs /usr/local/bin/meshbbs
# Create app directory
WORKDIR /app
# Expose volume mount point
VOLUME ["/app/data"]
# Run the BBS
ENTRYPOINT ["meshbbs"]
CMD ["start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment