feat(workspace): working mosh/ssh

This commit is contained in:
Tine Jozelj 2020-12-26 23:00:13 +01:00
parent ded6930dc6
commit 2c67e3f8bd
No known key found for this signature in database
GPG key ID: 3818B74E3830D7CF
5 changed files with 14 additions and 6 deletions

View file

@ -38,6 +38,7 @@ jobs:
echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION} echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
--build-arg REPOSITORY=ghcr.io/mentos1386 \
--build-arg VERSION=${VERSION} \ --build-arg VERSION=${VERSION} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=${GITHUB_SHA::8} \ --build-arg VCS_REF=${GITHUB_SHA::8} \

View file

@ -4,7 +4,8 @@ FROM alpine:3.12
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>" LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace 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 RUN apk --update --no-cache add bash
@ -17,7 +18,10 @@ RUN apk --update --no-cache add \
openssh-server \ openssh-server \
tmux \ tmux \
zsh \ zsh \
gcc \
libc-dev \
&& adduser -D "${SSH_USER}" -s /bin/zsh \ && 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_rsa_key -N '' -t rsa \
&& ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa \ && ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa \
&& ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa \ && ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa \
@ -33,7 +37,6 @@ RUN apk --update --no-cache add \
# Configure SSH # Configure SSH
RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config \ RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config \
&& echo "PasswordAuthentication no" >> /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 && echo "X11Forwarding no" >> /etc/ssh/sshd_config
# install tools # 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 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 ENV PATH=/home/${SSH_USER}/.go/bin:$PATH
# Rust # Rust
COPY --from=rust:1.48.0-alpine --chown=${SSH_USER} /usr/local/cargo /home/${SSH_USER}/.cargo COPY --from=ghcr.io/mentos1386/rust:1.48.0 --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/rustup /home/${SSH_USER}/.rustup
ENV CARGO_HOME=/home/${SSH_USER}/.cargo ENV CARGO_HOME=/home/${SSH_USER}/.cargo
ENV RUSTUP_HOME=/home/${SSH_USER}/.rustup ENV RUSTUP_HOME=/home/${SSH_USER}/.rustup
ENV PATH=/home/${SSH_USER}/.cargo/bin:$PATH ENV PATH=/home/${SSH_USER}/.cargo/bin:$PATH

View file

@ -29,3 +29,6 @@ pull:
run: run:
@docker run -it --rm --workdir /home/tine --user tine ghcr.io/mentos1386/workspace:edge zsh @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

View file

@ -1,8 +1,8 @@
version: "3" version: "3"
services: services:
workspace-ubuntu: workspace:
image: ghcr.io/mentos1386/workspace-ubuntu:edge image: ghcr.io/mentos1386/workspace:edge
ports: ports:
- 0.0.0.0:22022:22/tcp - 0.0.0.0:22022:22/tcp
- 0.0.0.0:22022:22022/udp - 0.0.0.0:22022:22022/udp

View file

@ -38,6 +38,7 @@ jobs:
echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION} echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
--build-arg REPOSITORY=[[[.repository]]] \
--build-arg VERSION=${VERSION} \ --build-arg VERSION=${VERSION} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=${GITHUB_SHA::8} \ --build-arg VCS_REF=${GITHUB_SHA::8} \