Dockerfile
· 996 B · Docker
Raw
FROM golang:1.20.5-bullseye
# Install `openssh-server` and other dependencies
RUN apt update \
&& apt upgrade -y \
&& apt install openssh-server sudo curl git wget software-properties-common apt-transport-https --yes \
&& rm -rf /var/lib/apt/lists/*
# Permit empty passwords
RUN sed -i 's/nullok_secure/nullok/' /etc/pam.d/common-auth
RUN echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
# Generate a workspace host key
RUN ssh-keygen -A
RUN chmod 775 /etc/ssh/ssh_host_rsa_key && \
chmod 775 /etc/ssh/ssh_host_ecdsa_key && \
chmod 775 /etc/ssh/ssh_host_ed25519_key
# Create a `gitlab-workspaces` user
RUN useradd -l -u 5001 -G sudo -md /home/gitlab-workspaces -s /bin/bash gitlab-workspaces
RUN passwd -d gitlab-workspaces
ENV HOME=/home/gitlab-workspaces
WORKDIR $HOME
RUN mkdir -p /home/gitlab-workspaces && chgrp -R 0 /home && chmod -R g=u /etc/passwd /etc/group /home
# Allow sign-in access to `/etc/shadow`
RUN chmod 775 /etc/shadow
USER gitlab-workspaces
| 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 |
| 30 |