From 457380ffa4b6d0a31bf32b50b5207d619b447ab0 Mon Sep 17 00:00:00 2001 From: hanez Date: Sun, 8 Jun 2025 00:35:43 +0200 Subject: [PATCH] Refactoring... --- Dockerfile | 39 +++++++++++++++++---------------------- Dockerfile.Debian | 32 ++++++++++++++++++++++++++++++++ README.md | 8 ++++---- 3 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 Dockerfile.Debian diff --git a/Dockerfile b/Dockerfile index 4b1cc5a..44035a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,18 @@ FROM alpine:3.22 -#FROM rust:latest -ENV TZ="Europe/Berlin" -WORKDIR /root -RUN apk add --no-cache alpine-sdk ca-certificates - -ENV RUSTUP_HOME=/usr/local/rustup \ +ENV \ CARGO_HOME=/usr/local/cargo \ PATH=/usr/local/cargo/bin:$PATH \ - RUST_VERSION=1.87.0 + RUST_VERSION=1.87.0 \ + RUSTUP_HOME=/usr/local/rustup \ + TZ="Europe/Berlin" +WORKDIR /root + +# Do this because next steps require some software packages to be installed +RUN apk add --no-cache alpine-sdk ca-certificates perl protobuf + +# Install Rust RUN set -eux; \ apkArch="$(apk --print-arch)"; \ case "$apkArch" in \ @@ -28,33 +31,25 @@ RUN set -eux; \ cargo --version; \ rustc --version; -#RUN git clone --branch v1.1.0 --single-branch https://github.com/microsoft/edit.git edit -#RUN cargo build --manifest-path /home/rust-docker/edit/Cargo.toml --profile dev -#RUN cp /home/rust-docker/edit/target/release/edit /usr/bin/ - -#RUN git clone --branch v0.7.1 --single-branch https://github.com/boxdot/gurk-rs.git gurk -#RUN cargo build --manifest-path /home/rust-docker/gurk/Cargo.toml --profile release -#RUN cp /home/rust-docker/gurk/target/release/gurk /usr/bin/ +# Install Rust based applications +RUN git clone --branch v0.7.1 --single-branch https://github.com/boxdot/gurk-rs.git gurk +RUN cargo build --manifest-path /root/gurk/Cargo.toml --profile release +RUN cp /root/gurk/target/release/gurk /usr/bin/ RUN git clone --branch 25.01.1 --single-branch https://github.com/helix-editor/helix.git helix RUN cargo build --manifest-path /root/helix/Cargo.toml --profile release RUN cp /root/helix/target/release/hx /usr/bin/ -#RUN git clone --branch v1.0.0 --single-branch https://github.com/FedericoBruzzone/tgt.git tgt -#RUN cargo build --manifest-path /home/rust-docker/tgt/Cargo.toml --profile release --features download-tdlib -#RUN cp /home/rust-docker/tgt/target/release/tgt /usr/bin/ - +# System setup RUN apk update RUN apk upgrade --available RUN apk add --no-cache bash mc openssh shadow tmux vim zsh zsh-vcs neovim -#RUN apt update -y -#RUN apt dist-upgrade -y -#RUN apt install -y apt-utils build-essential byobu git mc protobuf-compiler tmux vim zsh - RUN chsh -s /bin/zsh root RUN useradd -M -u 1000 -U -s /bin/zsh -d /home/hanez hanez RUN useradd -M -u 1001 -U -s /bin/bash -d /home/test test +RUN useradd -M -u 1002 -U -s /bin/bash -d /home/test test2 +# This is obsolete since I use docker-compose for managing the container ENTRYPOINT ["bash"] diff --git a/Dockerfile.Debian b/Dockerfile.Debian new file mode 100644 index 0000000..7abfddb --- /dev/null +++ b/Dockerfile.Debian @@ -0,0 +1,32 @@ +FROM rust:latest +ENV TZ="Europe/Berlin" +WORKDIR /root + +RUN apt install protobuf-compiler + +#RUN git clone --branch v1.1.0 --single-branch https://github.com/microsoft/edit.git edit +#RUN cargo build --manifest-path /home/rust-docker/edit/Cargo.toml --profile dev +#RUN cp /home/rust-docker/edit/target/release/edit /usr/bin/ + +RUN git clone --branch v0.7.1 --single-branch https://github.com/boxdot/gurk-rs.git gurk +RUN cargo build --manifest-path /home/rust-docker/gurk/Cargo.toml --profile release +RUN cp /home/rust-docker/gurk/target/release/gurk /usr/bin/ + +RUN git clone --branch 25.01.1 --single-branch https://github.com/helix-editor/helix.git helix +RUN cargo build --manifest-path /root/helix/Cargo.toml --profile release +RUN cp /root/helix/target/release/hx /usr/bin/ + +#RUN git clone --branch v1.0.0 --single-branch https://github.com/FedericoBruzzone/tgt.git tgt +#RUN cargo build --manifest-path /home/rust-docker/tgt/Cargo.toml --profile release --features download-tdlib +#RUN cp /home/rust-docker/tgt/target/release/tgt /usr/bin/ + +RUN apt update -y +RUN apt dist-upgrade -y +RUN apt install -y apt-utils build-essential byobu git mc protobuf-compiler tmux vim zsh + +RUN chsh -s /bin/zsh root +RUN useradd -M -u 1000 -U -s /bin/zsh -d /home/hanez hanez +RUN useradd -M -u 1001 -U -s /bin/bash -d /home/test test + +ENTRYPOINT ["bash"] + diff --git a/README.md b/README.md index c3d3de7..2972737 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Why Alpine? Because Alpine Linux is definitely the best Linux based operating sy Why the name "rusty"? Because it is based on some earlier Docker stuff I made for compiling Rust code... And rusty just sounds cool. -It still includes a full Rust environment/SDK! You need to add "/usr/local/cargo/bin to" your $PATH if you want to make use of it; For user "root" it is done by Docker. +It still includes a full Rust environment/SDK! You need to add "/usr/local/cargo/bin" to your $PATH if you want to make use of it; For user "root" it is done by Docker. Why Rust? Because I really like this language... @@ -37,12 +37,12 @@ My plan is to switch from Docker to native Linux Containers at some time but I a Optionally you can configure your $HOME directories (/home/$USER and /root). I do this by pulling my $HOME configuration from my Git server. Pulling my $HOME configuration will not work for you because you are not allowed to pull via the Git protocol. This is just an example on how I do it... E.g.: - git clone git@git.xw3.org:hanez/home.git home/hanez/ - sudo git clone git@git.xw3.org:hanez/home.git root/ + git clone git@git.xw3.org:hanez/home.git home/hanez + sudo git clone git@git.xw3.org:hanez/home.git root I manage these Git based $HOME directories/repositories outside of the container. -If you do not configure your $HOME directories here, the container's defaults will be used. +If you do not configure your $HOME directories here, the container creates missing configuration files. ## Using docker compose