leshe4ka revised this gist . Go to revision
1 file changed, 29 insertions
Dockerfile(file created)
| @@ -0,0 +1,29 @@ | |||
| 1 | + | FROM golang:1.20.5-bullseye | |
| 2 | + | ||
| 3 | + | # Install `openssh-server` and other dependencies | |
| 4 | + | RUN apt update \ | |
| 5 | + | && apt upgrade -y \ | |
| 6 | + | && apt install openssh-server sudo curl git wget software-properties-common apt-transport-https --yes \ | |
| 7 | + | && rm -rf /var/lib/apt/lists/* | |
| 8 | + | ||
| 9 | + | # Permit empty passwords | |
| 10 | + | RUN sed -i 's/nullok_secure/nullok/' /etc/pam.d/common-auth | |
| 11 | + | RUN echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config | |
| 12 | + | ||
| 13 | + | # Generate a workspace host key | |
| 14 | + | RUN ssh-keygen -A | |
| 15 | + | RUN chmod 775 /etc/ssh/ssh_host_rsa_key && \ | |
| 16 | + | chmod 775 /etc/ssh/ssh_host_ecdsa_key && \ | |
| 17 | + | chmod 775 /etc/ssh/ssh_host_ed25519_key | |
| 18 | + | ||
| 19 | + | # Create a `gitlab-workspaces` user | |
| 20 | + | RUN useradd -l -u 5001 -G sudo -md /home/gitlab-workspaces -s /bin/bash gitlab-workspaces | |
| 21 | + | RUN passwd -d gitlab-workspaces | |
| 22 | + | ENV HOME=/home/gitlab-workspaces | |
| 23 | + | WORKDIR $HOME | |
| 24 | + | RUN mkdir -p /home/gitlab-workspaces && chgrp -R 0 /home && chmod -R g=u /etc/passwd /etc/group /home | |
| 25 | + | ||
| 26 | + | # Allow sign-in access to `/etc/shadow` | |
| 27 | + | RUN chmod 775 /etc/shadow | |
| 28 | + | ||
| 29 | + | USER gitlab-workspaces | |
Newer
Older