Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2025
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. FROM ubuntu:22.04 AS builder
  2.  
  3. # Set noninteractive installation and locale
  4. ENV DEBIAN_FRONTEND=noninteractive
  5. ENV LANG C.UTF-8
  6. ENV LC_ALL C.UTF-8
  7.  
  8. # Install build dependencies
  9. RUN apt-get update && apt-get install -y \
  10. git \
  11. gcc \
  12. make \
  13. autoconf \
  14. automake \
  15. pkg-config \
  16. libtool \
  17. build-essential \
  18. libncurses5-dev \
  19. libncursesw5-dev \
  20. libevent-dev \
  21. bison \
  22. locales \
  23. && rm -rf /var/lib/apt/lists/*
  24.  
  25. # Set locale
  26. RUN locale-gen C.UTF-8
  27.  
  28. # Clone and build libevent statically
  29. WORKDIR /src
  30. RUN git clone https://github.com/libevent/libevent.git \
  31. && cd libevent \
  32. && ./autogen.sh \
  33. && CFLAGS="-O2 -static" ./configure --prefix=/usr --disable-shared --enable-static \
  34. && make \
  35. && make install
  36.  
  37. # Clone and build tmux with static linking and specific GLIBC targeting
  38. WORKDIR /src
  39. RUN git clone https://github.com/tmux/tmux.git \
  40. && cd tmux \
  41. && sh autogen.sh \
  42. && LDFLAGS="-static" CFLAGS="-O2 -static -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong" ./configure --enable-static \
  43. && make LDFLAGS="-static" CFLAGS="-O2 -static -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong"
  44.  
  45. # Create a runtime image
  46. FROM ubuntu:22.04
  47. COPY --from=builder /src/tmux/tmux /usr/local/bin/tmux
  48. ENV LANG C.UTF-8
  49. ENV LC_ALL C.UTF-8
  50. CMD ["tmux"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement