vagd.templates

Attributes

VAGRANT_TEMPLATE

LOCK_PACKAGES

DOCKER_TEMPLATE

DOCKER_ALPINE_TEMPLATE

Module Contents

vagd.templates.VAGRANT_TEMPLATE = Multiline-String
Show Value
"""# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "{box}"

end"""
vagd.templates.LOCK_PACKAGES = Multiline-String
Show Value
"""
ADD https://raw.githubusercontent.com/reproducible-containers/repro-sources-list.sh/v0.1.4/repro-sources-list.sh     /usr/local/bin/repro-sources-list.sh
RUN bash /usr/local/bin/repro-sources-list.sh
"""
vagd.templates.DOCKER_TEMPLATE = Multiline-String
Show Value
"""FROM {image}

USER root

{lock}

# install packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y {packages}
RUN apt clean && rm -rf /var/lib/apt/lists/*

# init user and ssh
EXPOSE 22
RUN useradd --create-home --shell /bin/bash -g sudo {user}
RUN chown -R {user}:sudo /home/{user}
RUN chmod u+s /usr/bin/sudo
RUN echo "{user} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/{user} && chmod 0440 /etc/sudoers.d/{user}
USER {user}

WORKDIR /home/{user}
COPY {keyfile} .ssh/authorized_keys

USER root
COPY {keyfile} /root/.ssh/authorized_keys
RUN mkdir -p /run/sshd && \
  chmod 755 /run/sshd

ENTRYPOINT []

CMD /usr/sbin/sshd; \
  while true; do sleep 1m; done
"""
vagd.templates.DOCKER_ALPINE_TEMPLATE = Multiline-String
Show Value
"""FROM {image}

USER root

# install packages
RUN apk update
RUN apk add --no-cache python3
RUN apk add --no-cache musl-dbg
# install gdb
RUN apk add --no-cache gdb
# install ssh server support and keys
RUN apk add --no-cache openssh
# install sudo
RUN apk add --no-cache sudo

EXPOSE 22
RUN chmod u+s /usr/bin/sudo
RUN adduser -h /home/{user} -s /bin/ash -g sudo -D {user}
RUN echo "{user} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/{user} && chmod 0440 /etc/sudoers.d/{user}
RUN echo "{user}:{user}" | chpasswd
RUN sed "s/AllowTcpForwarding no/AllowTcpForwarding yes/" -i /etc/ssh/sshd_config

USER {user}

WORKDIR /home/{user}

COPY {keyfile} .ssh/authorized_keys

USER root
COPY {keyfile} /root/.ssh/authorized_keys
RUN ssh-keygen -A
RUN mkdir -p /run/sshd &&   chmod 755 /run/sshd

ENTRYPOINT []

CMD /usr/sbin/sshd;   while true; do sleep 1m; done

"""