From e07bee244d7cd19c8950169259e411b2dd058c0b Mon Sep 17 00:00:00 2001 From: Clint Olson Date: Tue, 1 Oct 2024 17:58:42 -0700 Subject: [PATCH 1/3] Update Dockerfiles to use a modern distro and the offical package --- docker/Dockerfile.client | 38 ++++++++++++------------------------ docker/Dockerfile.server | 42 ++++++++++++---------------------------- 2 files changed, 24 insertions(+), 56 deletions(-) diff --git a/docker/Dockerfile.client b/docker/Dockerfile.client index 63cea76bf..a76ec048c 100644 --- a/docker/Dockerfile.client +++ b/docker/Dockerfile.client @@ -1,30 +1,16 @@ -FROM centos:8 as base +FROM debian:bookworm-slim + +RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \ + --mount=type=cache,mode=0755,target=/var/cache/apt,sharing=locked \ + rm -f /etc/apt/apt.conf.d/docker-clean && \ + apt-get update -qq && \ + apt-get install -y curl && \ + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \ + echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \ + curl -sSL https://github.com/MisterTea/debian-et/raw/master/et.gpg > /etc/apt/trusted.gpg.d/et.gpg && \ + apt-get update -qq && \ + apt-get install -y et -ENV BUILD_REPOS="epel-release centos-release-scl" \ - BUILD_DEPS="cmake3 boost-devel libsodium-devel protobuf-devel \ - protobuf-compiler gflags-devel protobuf-lite-devel git \ - perl-IPC-Cmd perl-Data-Dumper libunwind-devel libutempter-devel \ - devtoolset-11 devtoolset-11-libatomic-devel rh-git227" - - -WORKDIR / - -RUN yum install -y $BUILD_REPOS && \ - yum install -y $BUILD_DEPS && \ - git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git && \ - cd EternalTerminal && \ - mkdir build && \ - cd build && \ - bash -c "scl enable devtoolset-11 rh-git227 'cmake3 ../'" && \ - bash -c "scl enable devtoolset-11 'make -j $(grep ^processor /proc/cpuinfo |wc -l) && make install'" - -FROM centos:8 - -RUN yum install -y epel-release && \ - yum install -y protobuf-lite libsodium libatomic libunwind - -COPY --from=base /usr/bin/etserver /usr/bin/etterminal /usr/bin/htm /usr/bin/htmd /usr/bin/ -COPY --from=base /EternalTerminal/etc/et.cfg /etc/et.cfg COPY --chmod=755 container-entrypoint /bin/container-entrypoint ENTRYPOINT ["/bin/container-entrypoint", "client"] diff --git a/docker/Dockerfile.server b/docker/Dockerfile.server index 62a41edc3..c9ba3953c 100644 --- a/docker/Dockerfile.server +++ b/docker/Dockerfile.server @@ -1,34 +1,16 @@ -FROM centos:8 as base +FROM debian:bookworm-slim + +RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \ + --mount=type=cache,mode=0755,target=/var/cache/apt,sharing=locked \ + rm -f /etc/apt/apt.conf.d/docker-clean && \ + apt-get update -qq && \ + apt-get install -y curl && \ + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \ + echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \ + curl -sSL https://github.com/MisterTea/debian-et/raw/master/et.gpg > /etc/apt/trusted.gpg.d/et.gpg && \ + apt-get update -qq && \ + apt-get install -y et -ENV BUILD_REPOS="epel-release centos-release-scl" \ - BUILD_DEPS="cmake3 boost-devel libsodium-devel protobuf-devel \ - protobuf-compiler gflags-devel protobuf-lite-devel git \ - perl-IPC-Cmd perl-Data-Dumper libunwind-devel libutempter-devel \ - devtoolset-11 devtoolset-11-libatomic-devel rh-git227" - - -WORKDIR / - -RUN yum install -y $BUILD_REPOS && \ - yum install -y $BUILD_DEPS && \ - git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git && \ - cd EternalTerminal && \ - mkdir build && \ - cd build && \ - bash -c "scl enable devtoolset-11 rh-git227 'cmake3 ../'" && \ - bash -c "scl enable devtoolset-11 'make -j $(grep ^processor /proc/cpuinfo |wc -l) && make install'" - -FROM centos:8 - -RUN yum install -y epel-release && \ - yum install -y protobuf-lite libsodium openssh-server libatomic libunwind - -COPY --from=base /usr/bin/etserver /usr/bin/etterminal /usr/bin/htm /usr/bin/htmd /usr/bin/ -COPY --from=base /EternalTerminal/etc/et.cfg /etc/et.cfg COPY --chmod=755 container-entrypoint /bin/container-entrypoint -EXPOSE 2022 2222 - ENTRYPOINT ["/bin/container-entrypoint", "server"] - -CMD ["--cfgfile=/etc/et.cfg"] From 69165ca425265258b75f71c35b5a0895e755c157 Mon Sep 17 00:00:00 2001 From: Clint Olson Date: Tue, 1 Oct 2024 18:16:43 -0700 Subject: [PATCH 2/3] Add comments and small optimizations --- docker/Dockerfile.client | 9 ++++++--- docker/Dockerfile.server | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile.client b/docker/Dockerfile.client index a76ec048c..7fe134fbd 100644 --- a/docker/Dockerfile.client +++ b/docker/Dockerfile.client @@ -1,13 +1,16 @@ FROM debian:bookworm-slim +# Use ADD to avoid having to install curl +ADD --chmod=644 https://github.com/MisterTea/debian-et/raw/master/et.gpg /etc/apt/trusted.gpg.d/et.gpg + +# Use a run cache to speed up rebuilding and avoid having to remove the cache when we're done RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \ --mount=type=cache,mode=0755,target=/var/cache/apt,sharing=locked \ rm -f /etc/apt/apt.conf.d/docker-clean && \ - apt-get update -qq && \ - apt-get install -y curl && \ echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \ + apt-get update -qq && \ + apt-get install -y ca-certificates && \ echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \ - curl -sSL https://github.com/MisterTea/debian-et/raw/master/et.gpg > /etc/apt/trusted.gpg.d/et.gpg && \ apt-get update -qq && \ apt-get install -y et diff --git a/docker/Dockerfile.server b/docker/Dockerfile.server index c9ba3953c..6c55377f6 100644 --- a/docker/Dockerfile.server +++ b/docker/Dockerfile.server @@ -1,13 +1,16 @@ FROM debian:bookworm-slim +# Use ADD to avoid having to install curl +ADD --chmod=644 https://github.com/MisterTea/debian-et/raw/master/et.gpg /etc/apt/trusted.gpg.d/et.gpg + +# Use a run cache to speed up rebuilding and avoid having to remove the cache when we're done RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \ --mount=type=cache,mode=0755,target=/var/cache/apt,sharing=locked \ rm -f /etc/apt/apt.conf.d/docker-clean && \ - apt-get update -qq && \ - apt-get install -y curl && \ echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \ + apt-get update -qq && \ + apt-get install -y ca-certificates && \ echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \ - curl -sSL https://github.com/MisterTea/debian-et/raw/master/et.gpg > /etc/apt/trusted.gpg.d/et.gpg && \ apt-get update -qq && \ apt-get install -y et From e6af7511b0c72585996d3bbb48c0b63d9aa820f1 Mon Sep 17 00:00:00 2001 From: Clint Olson Date: Tue, 1 Oct 2024 23:50:04 -0700 Subject: [PATCH 3/3] Make sure openssh-server and the proper rundir are created before starting --- docker/Dockerfile.client | 2 +- docker/Dockerfile.server | 2 +- docker/container-entrypoint | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.client b/docker/Dockerfile.client index 7fe134fbd..1063eb1ff 100644 --- a/docker/Dockerfile.client +++ b/docker/Dockerfile.client @@ -12,7 +12,7 @@ RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \ apt-get install -y ca-certificates && \ echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \ apt-get update -qq && \ - apt-get install -y et + apt-get install -y et openssh-server COPY --chmod=755 container-entrypoint /bin/container-entrypoint diff --git a/docker/Dockerfile.server b/docker/Dockerfile.server index 6c55377f6..cd77e0e41 100644 --- a/docker/Dockerfile.server +++ b/docker/Dockerfile.server @@ -12,7 +12,7 @@ RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \ apt-get install -y ca-certificates && \ echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \ apt-get update -qq && \ - apt-get install -y et + apt-get install -y et openssh-server COPY --chmod=755 container-entrypoint /bin/container-entrypoint diff --git a/docker/container-entrypoint b/docker/container-entrypoint index e4be87096..f1f233f56 100755 --- a/docker/container-entrypoint +++ b/docker/container-entrypoint @@ -3,6 +3,11 @@ set -x if [ "$1" == server ]; then + if [ ! -d /run/sshd ]; then + mkdir /run/sshd + chmod 0755 /run/sshd + fi + /usr/sbin/sshd shift exec etserver --logtostdout -v 1 "$@"