Refactoring...

This commit is contained in:
Johannes Findeisen 2025-06-08 00:35:43 +02:00
commit 457380ffa4
3 changed files with 53 additions and 26 deletions

View file

@ -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"]

32
Dockerfile.Debian Normal file
View file

@ -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"]

View file

@ -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