work/Dockerfile

208 lines
4.1 KiB
Docker

# focal as of 2020-04-23
FROM ubuntu@sha256:5747316366b8cc9e3021cd7286f42b2d6d81e3d743e2ab571f55bcd5df788cc8
ENV DEBIAN_FRONTEND noninteractive
ARG UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu
ARG UID_TO_ADD=1000
ARG GID_TO_ADD=1000
ARG USERNAME_TO_ADD=user
RUN \
echo "deb $UBUNTU_MIRROR focal main universe restricted multiverse" > /etc/apt/sources.list.new && \
echo "deb $UBUNTU_MIRROR focal-updates main universe restricted multiverse" >> /etc/apt/sources.list.new && \
echo "deb $UBUNTU_MIRROR focal-security main universe restricted multiverse" >> /etc/apt/sources.list.new && \
echo "deb $UBUNTU_MIRROR focal-backports main universe restricted multiverse" >> /etc/apt/sources.list.new && \
mv /etc/apt/sources.list.new /etc/apt/sources.list
RUN \
groupadd -g $GID_TO_ADD $USERNAME_TO_ADD && \
groupadd nixbld && \
useradd -u $UID_TO_ADD -g $GID_TO_ADD --home-dir /home/user -m -s /bin/bash $USERNAME_TO_ADD && \
usermod -p '*' $USERNAME_TO_ADD
ADD https://sneak.cloud/authorized_keys /root/.ssh/authorized_keys
ADD https://sneak.cloud/authorized_keys /home/user/.ssh/authorized_keys
# we only install essential system packages here
ARG SYSTEM_PACKAGES="\
anacron \
apt-transport-https \
build-essential \
byobu \
ca-certificates \
cron \
cronic \
curl \
git \
golang \
locales \
openssh-server \
rsync \
runit \
sudo \
tmux \
"
RUN /bin/bash -c "echo -e 'Y\n\n' | /usr/local/sbin/unminimize"
RUN \
apt update && \
apt -y upgrade && \
apt -y install $SYSTEM_PACKAGES && \
go get -v -u github.com/peterbourgon/runsvinit && \
cp /root/go/bin/runsvinit /usr/local/sbin/runsvinit && \
rm -rf /root/go && \
rm /etc/ssh/*host*key* && \
apt -y purge golang && \
apt -y autoremove
# nix for pkgs pls
RUN mkdir /nix && chown user:user /nix
ARG OTHER_PACKAGES=" \
apt-utils \
aspell \
aspell-en \
automake \
avahi-daemon \
avahi-utils \
bash-completion \
bc \
bind9-host \
bonnie++ \
build-essential \
byobu \
ca-certificates \
cmake \
curl \
daemontools \
debmirror \
default-jdk \
default-jre \
diffstat \
dnsutils \
docker.io \
dos2unix \
editorconfig \
ffmpeg \
fonts-indic \
fonts-ipafont-gothic \
fonts-ipafont-mincho \
fortune \
git \
gnupg2 \
gnupg-agent \
golang-go \
host \
imagemagick \
iputils-ping \
irssi \
jq \
lcov \
ldap-auth-client \
ldap-utils \
libasound2 \
libatk1.0-0 \
libboost-all-dev \
libbz2-dev \
libdb++-dev \
libffi-dev \
libgconf-2-4 \
libgtk-3-0 \
libjpeg-dev \
liblzma-dev \
libncurses5-dev \
libnss3 \
libnss-mdns \
libpng-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libtool \
libxcursor1 \
libxml2 \
libxml2-dev \
libxmlsec1-dev \
libxslt1-dev \
llvm \
locales \
lsof \
mailutils \
make \
man \
man-db \
mercurial \
mosh \
mutt \
netcat-openbsd \
nmap \
nscd \
openssh-server \
pandoc \
pass \
pbzip2 \
pinentry-curses \
pkg-config \
psmisc \
pv \
pwgen \
python3 \
python3-dev \
python3-pip \
rbenv \
rsync \
rsyslog \
rsyslog-gnutls \
rsyslog-relp \
screen \
snmp \
snmpd \
socat \
software-properties-common \
strace \
sudo \
tcpdump \
telnet \
texlive-latex-base \
tk-dev \
tmux \
tree \
ttf-wqy-microhei \
ttf-wqy-zenhei \
vagrant \
vim \
vim-gtk \
wamerican-insane \
wget \
xterm \
xz-utils \
zfsutils-linux \
zip \
zlib1g-dev \
"
#RUN apt -y install $OTHER_PACKAGES
USER root
ENV HOME /root
COPY ./root /
COPY ./build /tmp/build
RUN bash /tmp/build/root.sh
USER user
ENV HOME /home/user
RUN bash /tmp/build/user.sh
USER root
ENV HOME /root
RUN rm -rf /tmp/build
RUN chsh --shell /home/user/.nix-profile/bin/zsh user
RUN chmod +rx /etc/service/*/run
CMD ["/usr/local/sbin/runsvinit"]