diff --git a/.env b/.env new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3d7a298..64a78d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,30 @@ -FROM ubuntu:latest +FROM ubuntu:22.04 -CMD ["sh"] \ No newline at end of file +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y --no-install-recommends openssh-server sudo ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir /var/run/sshd + +RUN useradd -m -s /bin/bash crime1 \ + && useradd -m -s /bin/bash crime2 + +RUN mkdir -p /home/crime1 /home/crime2 \ + && chown -R crime1:crime1 /home/crime1 \ + && chown -R crime2:crime2 /home/crime2 + +RUN echo "crime2:crime2" | chpasswd + +RUN passwd -l crime1 + +COPY .env /home/crime1/.env +RUN chown crime1:crime1 /home/crime1/.env && chmod 600 /home/crime1/.env + +RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config +RUN sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords no/' /etc/ssh/sshd_config + +EXPOSE 22 + +CMD ["/usr/sbin/sshd","-D"] diff --git a/docker-compose.yml b/docker-compose.yml index 48438f9..f3e8667 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,7 @@ services: - script: - image: 'ubuntu:latest' - volumes: - - '/data/schule/:/data/schule/' - command: - - 'bash /data/schule/startup.sh' + escape-room: + build: . + container_name: escape-room ports: - - '22:22' + - "2222:22" + restart: unless-stopped