Dockerfile52 lines · 1276 chars # Multi-stage Dockerfile to build tmux from source on Debian oldstable-slim
# Stage 1: build
FROM debian:oldstable-slim AS builder
LABEL maintainer="BuildAgent"
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies (Autotools, libevent, ncurses, yacc/bison, etc.)
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
autoconf \
automake \
pkg-config \
libevent-dev \
libncurses-dev \
bison \
flex \
&& rm -rf /var/lib/apt/lists/*
# Copy source and build
WORKDIR /src
COPY . .
# Ensure autogen.sh is executable
RUN chmod +x autogen.sh
RUN sh autogen.sh \
&& ./configure \
&& make -j$(nproc) \
&& make install
# Stage 2: runtime image
FROM debian:oldstable-slim
LABEL maintainer="BuildAgent"
ENV DEBIAN_FRONTEND=noninteractive
# Install runtime dependencies (ncurses libraries). Libevent will be provided from /usr/local
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
libncurses5 \
libtinfo5 \
&& rm -rf /var/lib/apt/lists/*
# Copy installed files from builder
COPY --from=builder /usr/local /usr/local
# Ensure the dynamic linker can find /usr/local/lib
ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
# Default command: run tmux
CMD ["tmux"]