Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FROM ubuntu:22.04 AS builder
- # Set noninteractive installation and locale
- ENV DEBIAN_FRONTEND=noninteractive
- ENV LANG C.UTF-8
- ENV LC_ALL C.UTF-8
- # Install build dependencies
- RUN apt-get update && apt-get install -y \
- git \
- gcc \
- make \
- autoconf \
- automake \
- pkg-config \
- libtool \
- build-essential \
- libncurses5-dev \
- libncursesw5-dev \
- libevent-dev \
- bison \
- locales \
- && rm -rf /var/lib/apt/lists/*
- # Set locale
- RUN locale-gen C.UTF-8
- # Clone and build libevent statically
- WORKDIR /src
- RUN git clone https://github.com/libevent/libevent.git \
- && cd libevent \
- && ./autogen.sh \
- && CFLAGS="-O2 -static" ./configure --prefix=/usr --disable-shared --enable-static \
- && make \
- && make install
- # Clone and build tmux with static linking and specific GLIBC targeting
- WORKDIR /src
- RUN git clone https://github.com/tmux/tmux.git \
- && cd tmux \
- && sh autogen.sh \
- && LDFLAGS="-static" CFLAGS="-O2 -static -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong" ./configure --enable-static \
- && make LDFLAGS="-static" CFLAGS="-O2 -static -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong"
- # Create a runtime image
- FROM ubuntu:22.04
- COPY --from=builder /src/tmux/tmux /usr/local/bin/tmux
- ENV LANG C.UTF-8
- ENV LC_ALL C.UTF-8
- CMD ["tmux"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement