Skip to content

Instantly share code, notes, and snippets.

@peccu
Last active March 29, 2023 09:20
Show Gist options
  • Save peccu/33a166f991dc87fceb62e7f779838075 to your computer and use it in GitHub Desktop.
Save peccu/33a166f991dc87fceb62e7f779838075 to your computer and use it in GitHub Desktop.
build tmux for multiple environment
#!/bin/bash
VER_tmux=$1
curl -LO https://github.com/tmux/tmux/releases/download/${VER_tmux}/tmux-${VER_tmux}.tar.gz \
&& tar xf tmux-${VER_tmux}.tar.gz \
&& cd tmux-${VER_tmux} \
&& ./configure \
&& make -j$(nproc) \
&& make install \
&& cd .. \
&& rm -rf tmux-${VER_tmux}{,.tar.gz} \
&& mv /usr/local/bin/tmux /usr/local/bin/tmux_${VER_tmux}
FROM alpine as alpine
ENV os=alpine
RUN apk add bash
RUN bash -c 'ps -u $(id -u) -o "comm pid" 2>/dev/null || ps -o "comm,pid"' > /tmp/$os 2>&1
FROM debian:stable-slim as debian
ENV os=debian
RUN apt-get update && apt-get install -y procps
RUN bash -c 'ps -u $(id -u) -o "comm pid" 2>/dev/null || ps -o "comm,pid"' > /tmp/$os 2>&1
RUN apt-get install -y curl libevent-dev ncurses-dev build-essential bison pkg-config
ADD build.sh ./
ADD test-versions.sh ./
RUN bash test-versions.sh $os
FROM ubuntu:latest as ubuntu
ENV os=ubuntu
RUN apt-get update && apt-get install -y procps
RUN bash -c 'ps -u $(id -u) -o "comm pid" 2>/dev/null || ps -o "comm,pid"' > /tmp/$os 2>&1
RUN apt-get install -y curl libevent-dev ncurses-dev build-essential bison pkg-config
ADD build.sh ./
ADD test-versions.sh ./
RUN bash test-versions.sh $os
FROM fedora:latest as fedora
ENV os=fedora
RUN dnf install -y procps
RUN bash -c 'ps -u $(id -u) -o "comm pid" 2>/dev/null || ps -o "comm,pid"' > /tmp/$os 2>&1
RUN dnf update -y \
&& dnf install -y make gcc tar gzip p7zip ncurses-devel libevent-devel ncurses-devel gcc make bison pkg-config
ADD build.sh ./
ADD test-versions.sh ./
RUN bash test-versions.sh $os
FROM amazonlinux:2023 as al2023
ENV os=al2023
RUN dnf install -y procps
RUN bash -c 'ps -u $(id -u) -o "comm pid" 2>/dev/null || ps -o "comm,pid"' > /tmp/$os 2>&1
RUN dnf update -y \
&& dnf install -y make gcc tar gzip p7zip ncurses-devel libevent-devel ncurses-devel gcc make bison pkg-config
ADD build.sh ./
ADD test-versions.sh ./
RUN bash test-versions.sh $os
FROM amazonlinux:2 as al2
ENV os=al2
RUN yum install -y procps
RUN bash -c 'ps -u $(id -u) -o "comm pid" 2>/dev/null || ps -o "comm,pid"' > /tmp/$os 2>&1
RUN yum update -y \
&& yum install -y make gcc tar gzip p7zip ncurses-devel libevent-devel ncurses-devel gcc make bison pkg-config
ADD build.sh ./
ADD test-versions.sh ./
RUN bash test-versions.sh $os
FROM alpine
COPY --from=alpine /tmp/alpine ./alpine
RUN echo "===alpine===" >> /tmp/log
RUN cat alpine >> /tmp/log
COPY --from=debian /tmp/debian ./debian
RUN echo "===debian===" >> /tmp/log
RUN cat debian >> /tmp/log
COPY --from=ubuntu /tmp/ubuntu ./ubuntu
RUN echo "===ubuntu===" >> /tmp/log
RUN cat ubuntu >> /tmp/log
COPY --from=fedora /tmp/fedora ./fedora
RUN echo "===fedora===" >> /tmp/log
RUN cat fedora >> /tmp/log
COPY --from=al2023 /tmp/al2023 ./al2023
RUN echo "===al2023===" >> /tmp/log
RUN cat al2023 >> /tmp/log
COPY --from=al2 /tmp/al2 ./al2
RUN echo "===al2===" >> /tmp/log
RUN cat al2 >> /tmp/log
RUN cat /tmp/log
#!/bin/bash
# BUILDKIT_PROGRESS=plain \
# docker build . \
# --no-cache \
# --progress=plain \
# -t tmux-continuum-test
docker build . -t tmux-continuum-test \
&& docker run --rm tmux-continuum-test cat /tmp/log
#!/bin/bash
os=$1
# curl -sL https://api.github.com/repos/tmux/tmux/tags | jq -r '.[]|.name | select(. > "1.8")'
# for version in 3.3 3.3a 3.2 3.2a 3.1 3.1c 3.1b 3.1a 3.0 3.0a 2.9 2.9a 2.8 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.9 1.9a
# curl -sL https://api.github.com/repos/tmux/tmux/releases | jq -r '.[]|.tag_name | select(. > "1.8")'
for version in 3.3a 3.3 3.2a 3.2 3.1c 3.1b 3.1a 3.1 3.0a 3.0 2.9a 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.9a 1.9
do
./build.sh $version \
&& pushd /usr/local/bin \
&& ln -s tmux_${version} tmux \
&& popd \
&& echo "--- version: $version ---" >> /tmp/$os 2>&1 \
&& tmux -V >> /tmp/$os 2>&1 \
&& echo "before new-session" >> /tmp/$os 2>&1 \
&& tmux new-session -d -s test-command-name \
&& echo "after new-session" >> /tmp/$os 2>&1 \
&& bash -c 'ps -u $(id -u) -o "comm pid" 2>/dev/null || ps -o "comm,pid"' >> /tmp/$os 2>&1 \
&& tmux kill-server
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment