initial commit
This commit is contained in:
commit
cb38e11cdc
|
@ -0,0 +1,59 @@
|
|||
FROM archlinux/base:latest
|
||||
MAINTAINER viviridian <dev@vvn.space>
|
||||
|
||||
# update packages
|
||||
RUN pacman -Syu --noconfirm \
|
||||
# user
|
||||
&& useradd -U -m -u 1000 vivlim \
|
||||
# ssh
|
||||
&& pacman -S openssh --noconfirm \
|
||||
&& sed -i s/#PasswordAuthentication.*/PasswordAuthentication\ no/ /etc/ssh/sshd_config \
|
||||
&& sed -i s/#GatewayPorts.*/GatewayPorts\ yes/ /etc/ssh/sshd_config \
|
||||
&& sed -ie 's/#Port 22/Port 22/g' /etc/ssh/sshd_config \
|
||||
&& sed -ri 's/#HostKey \/etc\/ssh\/ssh_host_key/HostKey \/etc\/ssh\/keys\/ssh_host_key/g' /etc/ssh/sshd_config \
|
||||
&& sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/keys\/ssh_host_rsa_key/g' /etc/ssh/sshd_config \
|
||||
&& sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_dsa_key/HostKey \/etc\/ssh\/keys\/ssh_host_dsa_key/g' /etc/ssh/sshd_config \
|
||||
&& sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_ecdsa_key/HostKey \/etc\/ssh\/keys\/ssh_host_ecdsa_key/g' /etc/ssh/sshd_config \
|
||||
&& sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_ed25519_key/HostKey \/etc\/ssh\/keys\/ssh_host_ed25519_key/g' /etc/ssh/sshd_config \
|
||||
&& mkdir /etc/ssh/keys \
|
||||
# sudo
|
||||
&& pacman -S sudo --noconfirm \
|
||||
&& echo 'vivlim ALL=(ALL:ALL) ALL' | sudo EDITOR='tee -a' visudo \
|
||||
# delete user's password so sudo won't prompt for it
|
||||
&& passwd -d vivlim \
|
||||
# basic tools
|
||||
&& pacman -S vim git zsh base-devel man-db tmux vi --noconfirm \
|
||||
# install an aur helper
|
||||
&& cd /tmp \
|
||||
&& git clone https://aur.archlinux.org/yay.git \
|
||||
&& chown vivlim yay \
|
||||
&& cd yay \
|
||||
&& sudo -u vivlim makepkg -si --noconfirm \
|
||||
&& cd / \
|
||||
&& rm -rf /tmp/yay \
|
||||
# clean cache
|
||||
&& pacman -Scc --noconfirm
|
||||
|
||||
# oh-my-zsh
|
||||
RUN su vivlim -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh) --unattended" \
|
||||
&& chsh -s /usr/bin/zsh vivlim
|
||||
|
||||
# aur packages
|
||||
RUN su vivlim -c "yay -S --noconfirm --cleanafter vcsh myrepos"
|
||||
|
||||
# remove .zshrc because the config will overwrite it.
|
||||
RUN rm /home/vivlim/.zshrc
|
||||
|
||||
# Install languages: python, js, rust, elixir
|
||||
RUN pacman --noconfirm -Sy npm python-pipenv elixir \
|
||||
&& pacman -Scc --noconfirm
|
||||
|
||||
# patch on some more packages I forgot to add before (if rebuilding, merge up!)
|
||||
RUN pacman --noconfirm -Sy base iputils inotify-tools \
|
||||
&& pacman -Scc --noconfirm
|
||||
|
||||
COPY launch.sh /launch.sh
|
||||
COPY user_launch.sh /user_launch.sh
|
||||
|
||||
EXPOSE 22
|
||||
CMD ["/launch.sh"]
|
|
@ -0,0 +1,30 @@
|
|||
version: '3'
|
||||
services:
|
||||
arch:
|
||||
build: .
|
||||
image: viviridian/archdev
|
||||
container_name: arch
|
||||
hostname: arch_container
|
||||
volumes:
|
||||
#- ./launch.sh:/launch.sh:ro
|
||||
#- ./user_launch.sh:/user_launch.sh:ro
|
||||
- /home/vivlim/.ssh:/home/vivlim/.ssh:ro
|
||||
- /home/vivlim:/home/vivlim/external
|
||||
- home:/home/vivlim
|
||||
- ssh_server_keys:/etc/ssh/keys
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "7722:22"
|
||||
postgres_db:
|
||||
image: postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_PASSWORD: secret
|
||||
PGDATA: /pgdata
|
||||
volumes:
|
||||
- ./data/postgres:/pgdata
|
||||
|
||||
|
||||
volumes:
|
||||
ssh_server_keys:
|
||||
home:
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/sbin/bash
|
||||
|
||||
if [ "$(ls -A /etc/ssh/keys)" ]; then
|
||||
echo "keys exist in /etc/ssh/keys, using those."
|
||||
else
|
||||
echo "generating ssh keys"
|
||||
/usr/bin/ssh-keygen -A
|
||||
mv /etc/ssh/ssh_host*key* /etc/ssh/keys
|
||||
ssh-keygen -t rsa -b 4096 -f /etc/ssh/keys/ssh_host_key
|
||||
fi
|
||||
|
||||
echo "executing user launch script"
|
||||
su vivlim -c /user_launch.sh
|
||||
|
||||
echo "ready for connections!"
|
||||
|
||||
/usr/sbin/sshd -D
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/sbin/bash
|
||||
cd /home/vivlim
|
||||
vcsh clone git@github.com:vivlim/vcsh_mr.git mr
|
||||
mr up
|
||||
|
||||
# starting tmux
|
||||
tmux -2 new-session -d
|
||||
|
||||
# Update vim plugins in the background.
|
||||
tmux new-window -d -n vimconfig -t 9 bash
|
||||
tmux send-keys -t 9 "cd /home/vivlim/.vim \
|
||||
&& git submodule init \
|
||||
&& git submodule update \
|
||||
&& vim -E -c 'source ~/.vimrc' -c PluginInstall -c qall \
|
||||
&& curl https://sh.rustup.rs | bash -s -- -y \
|
||||
&& source ~/.cargo/env \
|
||||
&& rustup default stable \
|
||||
&& rustup component add rls rust-analysis rust-src \
|
||||
&& rustup default nightly" C-m
|
||||
|
||||
tmux new-window -t 1 zsh
|
||||
tmux kill-window -t 0
|
||||
|
||||
# check if password has been set and prompt if not
|
||||
passwd --status vivlim | grep -q NP
|
||||
if [ $? == 0 ]; then
|
||||
echo "No password is set. You will be prompted for one when you connect."
|
||||
tmux send-keys -t 1 "passwd vivlim" C-m
|
||||
fi
|
Loading…
Reference in New Issue