Skip to content

Commit

Permalink
Merge emdocker and emdocker-test images
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksejZhmulin committed Mar 26, 2024
1 parent 5abf327 commit 81b0670
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# generated with `ssh-keygen -f ./id_rsa`
id_rsa
110 changes: 88 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@

FROM embox/emdocker as build
FROM debian:bookworm
MAINTAINER Anton Kozlov <drakon.mega@gmail.com>

## Container utils
RUN echo "deb http://deb.debian.org/debian bullseye main" > /etc/apt/sources.list.d/bullseye.list
RUN echo "deb http://deb.debian.org/debian bullseye-updates main" >> /etc/apt/sources.list.d/bullseye.list
RUN echo "deb http://security.debian.org bullseye-security main" >> /etc/apt/sources.list.d/bullseye.list
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
sudo \
iptables \
openssh-server \
iproute2 \
bzip2 \
unzip \
xz-utils \
python3 \
python2 \
python-is-python2 \
curl \
dpkg \
make \
patch \
cpio \
build-essential \
binutils \
gcc \
gcc-multilib \
g++-multilib \
gdb \
qemu-system \
ruby \
bison \
flex \
bc \
autoconf \
pkg-config \
mtd-utils \
ntfs-3g \
autotools-dev \
automake \
xutils-dev \
libtool \
rpcbind \
nfs-kernel-server \
nfs-common \
samba \
Expand All @@ -18,46 +58,74 @@ RUN apt-get update && \
expect \
snmp \
xvfb \
xvnc4viewer \
xauth \
tigervnc-standalone-server \
tigervnc-common \
tigervnc-viewer \
ffmpeg \
git \
mime-support \
dosfstools && \
apt-get clean && \
rm -rf /var/lib/apt /var/cache/apt
rm -rf /var/lib/apt /var/cache/apt && \
rm /etc/apt/sources.list.d/bullseye.list

## arm crosscompiler
RUN curl -k -L "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2" | \
tar -jxC /opt

## aarch64 crosscompiler
RUN curl -k -L "https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz" | \
tar -xJC /opt

## risc-v crosscompiler
RUN curl -k -L -s "https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-ubuntu14.tar.gz" | \
tar -xzC /opt

# x86/test/fs nfs
## other crosscompilers
RUN for a in microblaze mips powerpc sparc; do \
curl -k -L "https://github.com/embox/crosstool/releases/download/2.42-13.2.0-14.2/$a-elf-toolchain.tar.bz2" | \
tar -jxC /opt; \
done

ENV PATH=$PATH:\
/opt/gcc-arm-none-eabi-6-2017-q2-update/bin:\
/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin:\
/opt/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-ubuntu14/bin:\
/opt/microblaze-elf-toolchain/bin:\
/opt/mips-elf-toolchain/bin:\
/opt/powerpc-elf-toolchain/bin:\
/opt/sparc-elf-toolchain/bin

COPY create_matching_user.sh /usr/local/sbin/
COPY docker_start.sh /usr/local/sbin/
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

RUN mkdir -p -m 777 /embox
RUN /usr/local/sbin/create_matching_user.sh user /embox
COPY user.bashrc /home/user/.bashrc
COPY user.bash_profile /home/user/.bash_profile

## x86/test/fs
RUN for i in $(seq 0 9); do \
mknod /dev/loop$i -m0660 b 7 $i; \
done

## x86/test/fs nfs
RUN mkdir -p -m 777 /var/nfs_test
COPY exports /etc/

# x86/test/fs cifs
## x86/test/fs cifs
RUN mkdir -p -m 777 /var/cifs_test
COPY smb.conf /etc/samba/

# x86/test/net
## x86/test/net
COPY dhcpd.conf /etc/dhcp/
COPY isc-dhcp-server /etc/default/
COPY ntp.conf /etc/
RUN useradd -u 65534 -o -ms /bin/bash rlogin_user
RUN /bin/echo -e "rlogin\nrlogin" | passwd rlogin_user

FROM scratch
MAINTAINER Anton Kozlov <drakon.mega@gmail.com>

COPY --from=build / /

ENV PATH=$PATH:\
/opt/gcc-arm-none-eabi-6-2017-q2-update/bin:\
/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin:\
/opt/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-ubuntu14/bin:\
/opt/microblaze-elf-toolchain/bin:\
/opt/mips-elf-toolchain/bin:\
/opt/powerpc-elf-toolchain/bin:\
/opt/sparc-elf-toolchain/bin

CMD mount -t tmpfs none /var/nfs_test && \
service rpcbind restart && \
/etc/init.d/nfs-kernel-server restart && \
Expand All @@ -66,5 +134,3 @@ CMD mount -t tmpfs none /var/nfs_test && \
/etc/init.d/ntp restart && \
inetd && \
/usr/local/sbin/docker_start.sh


15 changes: 15 additions & 0 deletions create_matching_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
user=$1
target_dir=$2
home=/home/$user
uid=$(stat -c %u $target_dir)
gid=$(stat -c %g $target_dir)

mkdir -p $home
chown -R $uid:$gid $home

if ! getent group $gid; then
groupadd -g $gid embox_user
fi

useradd -u $uid -g $gid -G sudo -d $home -s /bin/bash $user
6 changes: 6 additions & 0 deletions docker_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

/usr/local/sbin/create_matching_user.sh user /embox

mkdir -p /var/run/sshd
exec /usr/sbin/sshd -D
27 changes: 27 additions & 0 deletions id_rsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAmsnvOMna7yBhs83JRMXa6PQFh4o/zDAe9p6yYOo2DOtl6Tv9
CTjyamOXmEwesm6SaXjPIBQxUozKofcH17rDls1K6OwCaNpl0ym4rxaT/q1hAZu0
/2VninFgMw/us/paB/LeWdJ5lcdxXMKLgor4R3uI9HRcowMvHZ5R4x2t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TeKkYXPsSK8ausZTAu
zKM7zEe1cLPYTHyrFIWa44XGteeVrHSPCfRxrnZ08pz6Gp5XU4msdiraPnilky3R
v+3c8iytRbx0rM041z97Gece4hY3HqxRsRQ5ay3x92p5LvuQUeRm1vQUIdW7h+eV
gR/stWECgYEApyUJXnqGQ5GGd8vjCLct38cKekmgPyTaXDbMDIhXBikAcvBzEVZQ
qPdxhsFrDhUR62WiaDUW4LscOtoUpTqpjgMe6oWvXmT6fbhokn60cfz3snfxuNdn
hVaSNxmzBS/xKeW6TUtYtJsFzznvbvl3JgzBJjw3COQeDY+NEkxTkv0=
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions id_rsa.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCaye84ydrvIGGzzclExdro9AWHij/MMB72nrJg6jYM62XpO/0JOPJqY5eYTB6ybpJpeM8gFDFSjMqh9wfXusOWzUro7AJo2mXTKbivFpP+rWEBm7T/ZWeKcWAzD+6z+loH8t5Z0nmVx3FcwouCivhHe4j0dFyjAy8dnlHjHa1VShz1uNGQH74aY9G38BYSPr5HtSfJxPn9nvt812N/DRqEPGdkCgpKq1u8gU4bB1IMf38TsM+DcbhV/UTm50aSkAtqGnUd5Zo8kcwb+U6VVItlqErkD3YqFYjegvHU0vMsoINixK1E74MCKpD3BR7hjNKwOWB7A+94wvl8uwkM/PYT anton@twister
1 change: 1 addition & 0 deletions user.bash_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
. ~/.bashrc
4 changes: 4 additions & 0 deletions user.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export EMBOX_DIR=/embox
export AUTOQEMU_KVM_ARG=""

cd $EMBOX_DIR

0 comments on commit 81b0670

Please sign in to comment.