1
0
Fork 0
env/.dockerfile

89 lines
2.6 KiB
Plaintext
Raw Normal View History

FROM alpine:3.12
# install essential
RUN apk add --no-cache --update openssl wget curl \
&& echo hosts: dns files > /etc/nsswitch.conf
# install nix (https://github.com/NixOS/docker)
ARG NIX_VERSION=2.3.6
RUN wget https://nixos.org/releases/nix/nix-${NIX_VERSION}/nix-${NIX_VERSION}-x86_64-linux.tar.xz \
&& tar xf nix-${NIX_VERSION}-x86_64-linux.tar.xz \
&& addgroup -g 30000 -S nixbld \
&& for i in $(seq 1 30); do adduser -S -D -h /var/empty -g "Nix build user $i" -u $((30000 + i)) -G nixbld nixbld$i ; done \
&& mkdir -m 0755 /etc/nix \
&& echo 'sandbox = false' > /etc/nix/nix.conf \
&& mkdir -m 0755 /nix && USER=root sh nix-${NIX_VERSION}-x86_64-linux/install \
&& ln -s /nix/var/nix/profiles/default/etc/profile.d/nix.sh /etc/profile.d/ \
&& rm -r /nix-${NIX_VERSION}-x86_64-linux* \
&& rm -rf /var/cache/apk/* \
&& /nix/var/nix/profiles/default/bin/nix-collect-garbage --delete-old \
&& /nix/var/nix/profiles/default/bin/nix-store --optimise \
&& /nix/var/nix/profiles/default/bin/nix-store --verify --check-contents
ENV \
ENV=/etc/profile \
USER=root \
PATH=/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin \
GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \
NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
NIX_PATH=/nix/var/nix/profiles/per-user/root/channels
# install common
RUN apk add --no-cache --update \
sudo tzdataa \
unzip zip tar gzip xz upx \
\
zsh zsh-vcs ncurses \
zsh-autosuggestions \
zsh-syntax-highlighting \
exa jq \
neovim \
\
openssh-client \
git \
pass gnupg \
\
2020-11-04 01:42:34 +08:00
python3 python3-dev py3-pip \
2020-11-04 03:52:28 +08:00
\
2020-11-04 02:03:07 +08:00
linux-headers alpine-sdk
2018-03-27 23:47:53 +08:00
# install additional tooling
RUN echo '@edge-testing http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
RUN apk add --no-cache --update \
kubectl@edge-testing \
minio-client@edge-testing
2018-04-01 21:31:06 +08:00
# create user
RUN adduser -s /bin/zsh -D ambrose
RUN echo '' >> /etc/sudoers
RUN echo '## No password sudo' >> /etc/sudoers
RUN echo 'ambrose ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
2018-04-01 21:31:06 +08:00
2018-04-01 17:06:16 +08:00
# install dotfiles
2018-03-30 00:13:16 +08:00
WORKDIR /home/ambrose
2018-04-01 21:31:06 +08:00
COPY --chown=ambrose:ambrose . .
2018-03-27 23:47:53 +08:00
2018-04-01 21:31:06 +08:00
# switch to user
2018-03-27 23:47:53 +08:00
USER ambrose
2018-04-01 17:06:16 +08:00
# install user programs
2020-11-04 01:51:14 +08:00
RUN mkdir ~/.config/nvim/autoload/
RUN wget -O ~/.config/nvim/autoload/plug.vim --force-directories \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
RUN pip3 install --no-cache-dir --user thefuck
RUN pip3 install --no-cache-dir --user httpie
# TODO: https://github.com/bootandy/dust/
# TODO: https://github.com/TheLocehiliosan/yadm/
# open login shell by default
2018-03-27 23:47:53 +08:00
2018-04-02 22:27:31 +08:00
CMD ["/bin/zsh", "-l"]