Switched to Alpine as base image.
This commit is contained in:
parent
0809dfeb40
commit
f559acb31f
2 changed files with 42 additions and 7 deletions
39
Dockerfile
39
Dockerfile
|
|
@ -1,7 +1,33 @@
|
|||
FROM rust:latest
|
||||
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 \
|
||||
CARGO_HOME=/usr/local/cargo \
|
||||
PATH=/usr/local/cargo/bin:$PATH \
|
||||
RUST_VERSION=1.87.0
|
||||
|
||||
RUN set -eux; \
|
||||
apkArch="$(apk --print-arch)"; \
|
||||
case "$apkArch" in \
|
||||
x86_64) rustArch='x86_64-unknown-linux-musl'; rustupSha256='e6599a1c7be58a2d8eaca66a80e0dc006d87bbcf780a58b7343d6e14c1605cb2' ;; \
|
||||
aarch64) rustArch='aarch64-unknown-linux-musl'; rustupSha256='a97c8f56d7462908695348dd8c71ea6740c138ce303715793a690503a94fc9a9' ;; \
|
||||
*) echo >&2 "unsupported architecture: $apkArch"; exit 1 ;; \
|
||||
esac; \
|
||||
url="https://static.rust-lang.org/rustup/archive/1.28.2/${rustArch}/rustup-init"; \
|
||||
wget "$url"; \
|
||||
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
|
||||
chmod +x rustup-init; \
|
||||
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
|
||||
rm rustup-init; \
|
||||
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
|
||||
rustup --version; \
|
||||
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/
|
||||
|
|
@ -18,12 +44,15 @@ RUN cp /root/helix/target/release/hx /usr/bin/
|
|||
#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 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
|
||||
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -1,9 +1,15 @@
|
|||
# My Hack Environment in a Docker Container
|
||||
|
||||
The container actually is based on rust:latest which itself is based on Debian (Bookworm). Maybe I will switch to the Debian image, or better switch to an Alpine based image in the future. Actually I prefer the Debian image because it makes it more flexible to me because sometimes I need the GNU libc to compile programs.
|
||||
This container image is based on "alpine:3.22".
|
||||
|
||||
Why Alpine? Because Alpine Linux is definitely the best Linux based operating system distribution I ever have used since 1999!
|
||||
|
||||
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.
|
||||
|
||||
Why Rust? Because I really like this language...
|
||||
|
||||
My plan is to switch from Docker to native Linux Containers at some time but I am faster in building the prototype using Docker... ;)
|
||||
|
||||
## Prerequisites
|
||||
|
|
@ -42,7 +48,7 @@ If you do not configure your $HOME directories here, the container's defaults wi
|
|||
|
||||
docker compose build
|
||||
docker compose up -d
|
||||
docker attach rusty
|
||||
docker attach rusty
|
||||
|
||||
You can stop the container by executing "exit" or by hiting ctrl+c when attached. You can always detache the container when hiting ctrl+p and then ctrl+q. This is useful if you have a screen or a tmux session runningin your container, or maybe some other applications.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue