From 2c67e3f8bdd238c6660b1ec54d6a486d1c654eb9 Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Sat, 26 Dec 2020 23:00:13 +0100 Subject: [PATCH] feat(workspace): working mosh/ssh --- .github/workflows/workspace.yaml | 1 + Dockerfile | 11 +++++++---- Makefile | 3 +++ docker-compose.yml | 4 ++-- templates/actions/workspace.yaml.tmpl | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workspace.yaml b/.github/workflows/workspace.yaml index 9f0b028..8060266 100644 --- a/.github/workflows/workspace.yaml +++ b/.github/workflows/workspace.yaml @@ -38,6 +38,7 @@ jobs: echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${VERSION} echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + --build-arg REPOSITORY=ghcr.io/mentos1386 \ --build-arg VERSION=${VERSION} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg VCS_REF=${GITHUB_SHA::8} \ diff --git a/Dockerfile b/Dockerfile index 2f4e50c..def9f61 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ FROM alpine:3.12 LABEL maintainer="Tine Jozelj " LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace -ARG SSH_USER="${SSH_USER:-tine}" +ARG SSH_USER="tine" +ARG SSH_PASSWORD="tine" RUN apk --update --no-cache add bash @@ -17,7 +18,10 @@ RUN apk --update --no-cache add \ openssh-server \ tmux \ zsh \ + gcc \ + libc-dev \ && adduser -D "${SSH_USER}" -s /bin/zsh \ +&& echo -e "${SSH_PASSWORD}\n${SSH_PASSWORD}" | passwd "${SSH_USER}" \ && ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa \ && ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa \ && ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa \ @@ -33,7 +37,6 @@ RUN apk --update --no-cache add \ # Configure SSH RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config \ && echo "PasswordAuthentication no" >> /etc/ssh/sshd_config \ -&& echo "UsePAM no" >> /etc/ssh/sshd_config \ && echo "X11Forwarding no" >> /etc/ssh/sshd_config # install tools @@ -47,8 +50,8 @@ COPY --from=ghcr.io/mentos1386/mosh:master /usr/bin/mosh-client /usr/bin/mosh-cl COPY --from=golang:1.15.6-alpine --chown=${SSH_USER} /usr/local/go /home/${SSH_USER}/.go ENV PATH=/home/${SSH_USER}/.go/bin:$PATH # Rust -COPY --from=rust:1.48.0-alpine --chown=${SSH_USER} /usr/local/cargo /home/${SSH_USER}/.cargo -COPY --from=rust:1.48.0-alpine --chown=${SSH_USER} /usr/local/rustup /home/${SSH_USER}/.rustup +COPY --from=ghcr.io/mentos1386/rust:1.48.0 --chown=${SSH_USER} /usr/local/cargo /home/${SSH_USER}/.cargo +COPY --from=ghcr.io/mentos1386/rust:1.48.0 --chown=${SSH_USER} /usr/local/rustup /home/${SSH_USER}/.rustup ENV CARGO_HOME=/home/${SSH_USER}/.cargo ENV RUSTUP_HOME=/home/${SSH_USER}/.rustup ENV PATH=/home/${SSH_USER}/.cargo/bin:$PATH diff --git a/Makefile b/Makefile index 7c463dc..d4ee364 100644 --- a/Makefile +++ b/Makefile @@ -29,3 +29,6 @@ pull: run: @docker run -it --rm --workdir /home/tine --user tine ghcr.io/mentos1386/workspace:edge zsh +run-root: + @docker run -it --rm --workdir /home/tine --user root ghcr.io/mentos1386/workspace:edge zsh + diff --git a/docker-compose.yml b/docker-compose.yml index 8546329..9f42dfc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: "3" services: - workspace-ubuntu: - image: ghcr.io/mentos1386/workspace-ubuntu:edge + workspace: + image: ghcr.io/mentos1386/workspace:edge ports: - 0.0.0.0:22022:22/tcp - 0.0.0.0:22022:22022/udp diff --git a/templates/actions/workspace.yaml.tmpl b/templates/actions/workspace.yaml.tmpl index c43c589..a59a70e 100644 --- a/templates/actions/workspace.yaml.tmpl +++ b/templates/actions/workspace.yaml.tmpl @@ -38,6 +38,7 @@ jobs: echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${VERSION} echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + --build-arg REPOSITORY=[[[.repository]]] \ --build-arg VERSION=${VERSION} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg VCS_REF=${GITHUB_SHA::8} \