feat(workspace): add rust/go/node and docker-compose

This commit is contained in:
Tine Jozelj 2020-12-24 14:51:49 +01:00
parent bdb8dab6d6
commit 6f3a342a96
No known key found for this signature in database
GPG key ID: 3818B74E3830D7CF
3 changed files with 37 additions and 12 deletions

View file

@ -21,12 +21,21 @@ RUN set -ueox pipefail \
mosh \ mosh \
openssh-server \ openssh-server \
psmisc \ psmisc \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen \
&& adduser --quiet --gecos '' --disabled-password --add_extra_groups "${SSH_USER}" \ && adduser --quiet --gecos '' --disabled-password --add_extra_groups "${SSH_USER}" \
&& apt-get -yqq clean all \ && apt-get -yqq clean all \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
/tmp/* \ /tmp/* \
/var/tmp/* /var/tmp/*
# Configure SSH
RUN touch /etc/ssh/sshd_config.d/custom \
&& echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config.d/custom \
&& echo "PasswordAuthentication no" >> /etc/ssh/sshd_config.d/custom \
&& echo "UsePAM no" >> /etc/ssh/sshd_config.d/custom \
&& echo "X11Forwarding no" >> /etc/ssh/sshd_config.d/custom
# Install available packages # Install available packages
RUN set -ueox pipefail \ RUN set -ueox pipefail \
&& DEBIAN_FRONTEND=noninteractive \ && DEBIAN_FRONTEND=noninteractive \
@ -44,6 +53,18 @@ RUN set -ueox pipefail \
# Install other packages # Install other packages
COPY --from=ghcr.io/mentos1386/starship:0.47.0 /starship /usr/local/bin/starship COPY --from=ghcr.io/mentos1386/starship:0.47.0 /starship /usr/local/bin/starship
COPY --from=ghcr.io/mentos1386/kubectl:1.20.0 /kubectl /usr/local/bin/kubectl COPY --from=ghcr.io/mentos1386/kubectl:1.20.0 /kubectl /usr/local/bin/kubectl
# Golang
COPY --from=golang:1.15.6 --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 --chown=${SSH_USER} /usr/local/cargo /home/${SSH_USER}/.cargo
COPY --from=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
# Node
COPY --from=node:15.5.0 --chown=${SSH_USER} /usr/local/bin/node /usr/local/bin/node
# TODO: Add yarbn/npm/npx/yarnpkg??
# Create .dotfiles # Create .dotfiles
COPY --chown=${SSH_USER}:${SSH_USER} dotfiles /home/${SSH_USER}/.dotfiles COPY --chown=${SSH_USER}:${SSH_USER} dotfiles /home/${SSH_USER}/.dotfiles

View file

@ -1,21 +1,16 @@
.PHONY: build-ubuntu REGISTRY=ghcr.io/mentos1386
build-ubuntu:
@docker buildx build --load -t env-ubuntu -f Dockerfile.ubuntu . build:
@docker buildx build --load -t ${REGISTRY}/workspace-ubuntu:edge -f Dockerfile.ubuntu .
.PHONY: build-package-starship
build-package-starship: build-package-starship:
@docker buildx build --load -t starship -f packages/Dockerfile.starship packages/ @docker buildx build --load -t ${REGISTRY}/starship:0.47.0 -f packages/Dockerfile.starship packages/
.PHONY: build-package-kubectl
build-package-kubectl: build-package-kubectl:
@docker buildx build --load -t kubectl -f packages/Dockerfile.kubectl packages/ @docker buildx build --load -t ${REGISTRY}/kubectl:1.20.0 -f packages/Dockerfile.kubectl packages/
.PHONY: build-packages
build-packages: package-kubectl package-starship build-packages: package-kubectl package-starship
build: packages ubuntu
.PHONY: template
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 ubuntu-action > .github/workflows/ubuntu.yaml @go run ./main.go template ubuntu-action > .github/workflows/ubuntu.yaml
@ -25,6 +20,6 @@ pull:
@docker pull ghcr.io/mentos1386/starship:0.47.0 @docker pull ghcr.io/mentos1386/starship:0.47.0
@docker pull ghcr.io/mentos1386/kubectl:1.20.0 @docker pull ghcr.io/mentos1386/kubectl:1.20.0
run-ubuntu: run:
@docker run -it --rm --workdir /home/tine --user tine ghcr.io/mentos1386/workspace-ubuntu:edge zsh @docker run -it --rm --workdir /home/tine --user tine ghcr.io/mentos1386/workspace-ubuntu:edge zsh

9
docker-compose.yml Normal file
View file

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