This commit is contained in:
Tine Jozelj 2021-03-08 09:32:13 +01:00
parent c38f7f6076
commit d439e65478
4 changed files with 97 additions and 22 deletions

76
Dockerfile.golang Normal file
View file

@ -0,0 +1,76 @@
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
FROM golang:1.16-alpine
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace
ARG SSH_USER="tine"
ARG SSH_PASSWORD="tine"
RUN apk --update --no-cache add bash
SHELL ["bash", "-c"]
RUN apk --update --no-cache add \
git \
mosh \
neovim \
openssh-server \
tmux \
zsh \
gcc \
libc-dev \i
&& 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 \
&& ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519 \
&& chown root:root /etc/ssh \
&& chmod 0600 /etc/ssh/* \
&& mkdir -p /root/.ssh \
&& chmod 0700 /root/.ssh \
&& rm -rf /var/cache/apk/* \
/tmp/* \
/var/tmp/*
# Configure SSH
RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config \
&& echo "PasswordAuthentication no" >> /etc/ssh/sshd_config \
&& echo "X11Forwarding no" >> /etc/ssh/sshd_config
# install tools
COPY --from=ghcr.io/mentos1386/starship:0.47.0 /usr/local/bin/starship /usr/local/bin/starship
COPY --from=ghcr.io/mentos1386/kubectl:1.20.0 /usr/local/bin/kubectl /usr/local/bin/kubectl
COPY --from=ghcr.io/mentos1386/mosh:master /usr/bin/mosh /usr/bin/mosh
COPY --from=ghcr.io/mentos1386/mosh:master /usr/bin/mosh-server /usr/bin/mosh-server
COPY --from=ghcr.io/mentos1386/mosh:master /usr/bin/mosh-client /usr/bin/mosh-client
# Create .dotfiles
COPY --chown=${SSH_USER}:${SSH_USER} dotfiles /home/${SSH_USER}/.dotfiles
# User Configuration
USER "${SSH_USER}"
# GIT
RUN ln -s /home/${SSH_USER}/.dotfiles/git/gitconfig /home/${SSH_USER}/.gitconfig
# ZSH
RUN ln -s /home/${SSH_USER}/.dotfiles/zsh/zshrc /home/${SSH_USER}/.zshrc
# TMUX
RUN ln -s /home/${SSH_USER}/.dotfiles/tmux/tmux.conf /home/${SSH_USER}/.tmux.conf
# VIM
RUN mkdir -p "/home/${SSH_USER}/.config" \
&& ln -s "/home/${SSH_USER}/.dotfiles/nvim" "/home/${SSH_USER}/.config/nvim" \
&& ln -s "/home/${SSH_USER}/.dotfiles/nvim/vimrc" "/home/${SSH_USER}/.vimrc" \
&& git clone --depth 1 https://github.com/Shougo/dein.vim "/home/${SSH_USER}/.cache/vim/dein/repos/github.com/Shougo/dein.vim" \
&& nvim -V1 -es -i NONE -N --noplugin -u "/home/${SSH_USER}/.config/nvim/config/vimrc" \
-c "try | call dein#clear_state() | call dein#update() | finally | messages | qall! | endtry"
# SSH
RUN mkdir -p /home/${SSH_USER}/.ssh \
&& ln -s /home/${SSH_USER}/.dotfiles/ssh/authorized_keys /home/${SSH_USER}/.ssh/authorized_keys
USER root
EXPOSE 22/tcp
EXPOSE 22022/udp
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]

View file

@ -1,7 +1,6 @@
REGISTRY=ghcr.io/mentos1386 REGISTRY=ghcr.io/mentos1386
PROGRESS=plain PROGRESS=plain
build: build:
@docker buildx build --load -t ${REGISTRY}/workspace:edge -f Dockerfile . @docker buildx build --load -t ${REGISTRY}/workspace:edge -f Dockerfile .
@ -11,24 +10,17 @@ build-package-starship:
build-package-kubectl: build-package-kubectl:
@docker buildx build --load -t ${REGISTRY}/kubectl:1.20.0 -f packages/Dockerfile.kubectl . @docker buildx build --load -t ${REGISTRY}/kubectl:1.20.0 -f packages/Dockerfile.kubectl .
build-package-glow:
@docker buildx build --load -t ${REGISTRY}/glow:1.3.0 -f packages/Dockerfile.glow .
build-package-mosh: build-package-mosh:
@docker buildx build --progress ${PROGRESS} --load -t ${REGISTRY}/mosh:master -f packages/Dockerfile.mosh . @docker buildx build --progress ${PROGRESS} --load -t ${REGISTRY}/mosh:master -f packages/Dockerfile.mosh .
build-packages: package-kubectl package-starship build-packages: build-package-kubectl build-package-starship build-package-mosh
template: template:
@go run ./main.go template package-action > .github/workflows/packages.yaml @go run ./main.go template package-action > .github/workflows/packages.yaml
@go run ./main.go template workspace-action > .github/workflows/workspace.yaml @go run ./main.go template workspace-node-action > .github/workflows/workspace-node.yaml
pull: pull-node:
@docker pull ghcr.io/mentos1386/workspace:edge @docker pull ghcr.io/mentos1386/workspace-node:edge
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
run-node:
@docker run -it --rm --workdir /home/tine --user tine ${REGISTRY}/workspace-node:edge zsh

View file

@ -1,8 +1,7 @@
![Workspace](https://github.com/mentos1386/workspace/workflows/workspace/badge.svg) ![Workspace](https://github.com/mentos1386/workspace/workflows/workspace/badge.svg)
![Packages](https://github.com/mentos1386/workspace/workflows/packages/badge.svg) ![Packages](https://github.com/mentos1386/workspace/workflows/packages/badge.svg)
my workspace as a docker container # my workspace as a docker container
==================================
- [Introduction](#introduction) - [Introduction](#introduction)
- [Clipboard](#clipboard) - [Clipboard](#clipboard)
@ -16,8 +15,6 @@ my workspace as a docker container
- zsh, spaceship-prompt, git - zsh, spaceship-prompt, git
- [ ] Add the configurations i have - [ ] Add the configurations i have
- zsh, git, nextcloud - zsh, git, nextcloud
- [ ] GUI using VNC?
# Introduction # Introduction
@ -52,4 +49,3 @@ with ssh and recent `mosh`.
# References # References
[vim-oscyank plugin](https://github.com/ojroques/vim-oscyank) [vim-oscyank plugin](https://github.com/ojroques/vim-oscyank)

View file

@ -1,14 +1,25 @@
## ##
# Workspace # Workspace Node
[templates."workspace-action"] [templates."workspace-node-action"]
template = "templates/actions/workspace.yaml.tmpl" template = "templates/actions/workspace.yaml.tmpl"
[templates."workspace-action".vars] [templates."workspace-node-action".vars]
name = "workspace-node" name = "workspace-node"
dockerfile = "Dockerfile.node" dockerfile = "Dockerfile.node"
repository = "ghcr.io/mentos1386" repository = "ghcr.io/mentos1386"
platforms = "linux/amd64,linux/arm64" platforms = "linux/amd64,linux/arm64"
##
# Workspace Golang
[templates."workspace-golang-action"]
template = "templates/actions/workspace.yaml.tmpl"
[templates."workspace-golang-action".vars]
name = "workspace-golang"
dockerfile = "Dockerfile.golang"
repository = "ghcr.io/mentos1386"
platforms = "linux/amd64,linux/arm64"
## ##
# Packages # Packages
[templates."package-action"] [templates."package-action"]