Skip to content

Instantly share code, notes, and snippets.

@mniak
Created February 11, 2022 15:01
Show Gist options
  • Save mniak/4d710e4ad35e1be159b51bc994e646fb to your computer and use it in GitHub Desktop.
Save mniak/4d710e4ad35e1be159b51bc994e646fb to your computer and use it in GitHub Desktop.
#!/bin/bash
build-image () {
nerdctl build --platform=amd64 -f Dockerfile.devserver . -t devserver
[[ $? != 0 ]] && exit 1
}
run-container () {
nerdctl run -it -p 9022:22 --name devserver devserver
}
sudo systemctl start containerd
sudo nerdctl run --privileged --rm tonistiigi/binfmt --install all
if [ $(nerdctl image ls devserver --format="true") ]; then
if [[ "$1" == "-f" ]] || [[ "$1" == "--force" ]]; then
build-image
nerdctl rm devserver
run-container
else
nerdctl start devserver
fi
else
build-image
run-container
fi
FROM ubuntu:impish
RUN apt-get update
RUN apt-get install -y openssh-server
RUN apt-get install -y git
# Install Terraform CLI
RUN apt-get install -y gnupg software-properties-common curl
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
RUN apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
RUN apt-get update
RUN apt-get install -y terraform
RUN apt-get install software-properties-common
RUN add-apt-repository ppa:neovim-ppa/stable
RUN apt-get update
RUN apt-get install -y neovim
RUN apt-get install -y python-dev python3-dev python3-pip
RUN echo PermitEmptyPasswords yes >> /etc/ssh/sshd_config.d/10-passwordless.conf
RUN echo PermitRootLogin yes >> /etc/ssh/sshd_config.d/10-passwordless.conf
RUN passwd -d root
RUN adduser andre
RUN passwd -d andre
USER andre
WORKDIR /home/andre
#RUN git clone https://github.com/NvChad/NvChad .config/nvim --depth 1
#RUN nvim +'hi NormalFloat guibg=#1e222a' --headless +PackerSync +qall
COPY --chown=andre:andre .ssh/ .ssh/
COPY --chown=andre:andre .git* ./
USER root
RUN echo "#!/bin/bash" > /usr/bin/entrypoint.sh
RUN echo "service ssh start" >> /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
EXPOSE 22
ENTRYPOINT entrypoint.sh && /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment