Skip to content

Instantly share code, notes, and snippets.

@leophys
Created October 19, 2018 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leophys/6b1ac8cad9b2c491a5fc545a6c67878d to your computer and use it in GitHub Desktop.
Save leophys/6b1ac8cad9b2c491a5fc545a6c67878d to your computer and use it in GitHub Desktop.
FROM debian:stretch
ARG UID=1000
ENV DEBIAN_FRONTEND=noninteractive
ENV TARGETDIR="/home/builder/target"
RUN apt-get update \
&& apt-get install -y \
build-essential \
curl \
wget \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& useradd -m -u $UID builder
USER builder
WORKDIR /home/builder
RUN wget https://gist.githubusercontent.com/leophys/4409d02d68e1db0b5e651204eb89ad9d/raw/300057e89223b85684b796599a35657df54df1f7/build-tmux.sh \
&& chmod +x build-tmux.sh
ENTRYPOINT ["/home/builder/build-tmux.sh"]
CMD ["1"]
@leophys
Copy link
Author

leophys commented Oct 19, 2018

To build a static-linked version of tmux in a container (to obtain a portable version of tmux).

Build the image

docker build -t tmux-builder .

Compile with

First create a target directory on your host

mkdir target

Then run the build, mounting the target directory on the container

docker run -v $PWD/target:/home/builder/target tmux-builder

If you want to speed things up, append an integer roughly the number of your cpus at the end of the previous command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment