mirror of
https://github.com/mentos1386/dotfiles.git
synced 2024-11-25 00:48:19 +00:00
feat(workspace): switch to alpine from ubuntu
This commit is contained in:
parent
d9b7e189d3
commit
2223baa5b7
7 changed files with 42 additions and 56 deletions
|
@ -1,4 +1,4 @@
|
|||
name: ubuntu
|
||||
name: workspace
|
||||
|
||||
on:
|
||||
schedule:
|
||||
|
@ -11,7 +11,7 @@ on:
|
|||
- v*
|
||||
|
||||
jobs:
|
||||
ubuntu:
|
||||
workspace:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -19,7 +19,7 @@ jobs:
|
|||
- name: Prepare
|
||||
id: prepare
|
||||
run: |
|
||||
DOCKER_IMAGE=ghcr.io/mentos1386/workspace-ubuntu
|
||||
DOCKER_IMAGE=ghcr.io/mentos1386/workspace
|
||||
DOCKER_PLATFORMS=linux/amd64,linux/arm64
|
||||
VERSION=edge
|
||||
|
||||
|
@ -43,14 +43,14 @@ jobs:
|
|||
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||
${TAGS} --file ./Dockerfile.ubuntu .
|
||||
${TAGS} --file ./Dockerfile .
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-ubuntu-${{ github.sha }}
|
||||
key: ${{ runner.os }}-workspace-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ubuntu-
|
||||
${{ runner.os }}-workspace-
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,2 @@
|
|||
.swp
|
||||
*.swp
|
||||
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
|
||||
FROM ubuntu:20.10
|
||||
FROM alpine:3.12
|
||||
|
||||
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
|
||||
LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace
|
||||
|
||||
ARG SSH_USER="${SSH_USER:-tine}"
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
RUN apk --update --no-cache add bash
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
SHELL ["bash", "-c"]
|
||||
|
||||
RUN set -ueox pipefail \
|
||||
&& DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -yqq update \
|
||||
&& apt-get -yqq --no-install-recommends --no-install-suggests install \
|
||||
ca-certificates \
|
||||
locales \
|
||||
perl \
|
||||
RUN apk --update --no-cache add \
|
||||
git \
|
||||
mosh \
|
||||
neovim \
|
||||
openssh-server \
|
||||
psmisc \
|
||||
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
|
||||
&& locale-gen \
|
||||
&& adduser --quiet --gecos '' --disabled-password --add_extra_groups "${SSH_USER}" \
|
||||
&& apt-get -yqq clean all \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
tmux \
|
||||
zsh \
|
||||
&& adduser -D "${SSH_USER}" -s /bin/bash \
|
||||
&& 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/*
|
||||
|
||||
|
@ -36,27 +37,13 @@ RUN touch /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
|
||||
RUN set -ueox pipefail \
|
||||
&& DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -yqq update \
|
||||
&& apt-get -yqq --no-install-recommends --no-install-suggests install \
|
||||
git \
|
||||
tmux \
|
||||
vim \
|
||||
zsh \
|
||||
&& apt-get -yqq clean all \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
/tmp/* \
|
||||
/var/tmp/*
|
||||
|
||||
# Install other packages
|
||||
# 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/glow:1.3.0 /usr/local/bin/glow /usr/local/bin/glow
|
||||
COPY --from=ghcr.io/mentos1386/mosh:master /usr/local/bin/mosh /usr/local/bin/mosh
|
||||
COPY --from=ghcr.io/mentos1386/mosh:master /usr/local/bin/mosh-server /usr/local/bin/mosh-server
|
||||
COPY --from=ghcr.io/mentos1386/mosh:master /usr/local/bin/mosh-client /usr/local/bin/mosh-client
|
||||
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
|
||||
# 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
|
||||
|
@ -90,16 +77,14 @@ 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" \
|
||||
&& vim -V1 -es -i NONE -N --noplugin -u "/home/${SSH_USER}/.config/nvim/config/vimrc" \
|
||||
&& 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
|
||||
|
||||
# Start SSH Daemon
|
||||
USER root
|
||||
EXPOSE 22/tcp
|
||||
EXPOSE 22022/udp
|
||||
RUN mkdir -p /run/sshd
|
||||
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]
|
||||
|
6
Makefile
6
Makefile
|
@ -3,7 +3,7 @@ PROGRESS=plain
|
|||
|
||||
|
||||
build:
|
||||
@docker buildx build --load -t ${REGISTRY}/workspace-ubuntu:edge -f Dockerfile.ubuntu .
|
||||
@docker buildx build --load -t ${REGISTRY}/workspace:edge -f Dockerfile .
|
||||
|
||||
build-package-starship:
|
||||
@docker buildx build --load -t ${REGISTRY}/starship:0.47.0 -f packages/Dockerfile.starship packages/
|
||||
|
@ -21,7 +21,7 @@ build-packages: package-kubectl package-starship
|
|||
|
||||
template:
|
||||
@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 workspace-action > .github/workflows/workspace.yaml
|
||||
|
||||
pull:
|
||||
@docker pull ghcr.io/mentos1386/workspace-ubuntu:edge
|
||||
|
@ -29,5 +29,5 @@ pull:
|
|||
@docker pull ghcr.io/mentos1386/kubectl:1.20.0
|
||||
|
||||
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:edge zsh
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
![Ubuntu](https://github.com/mentos1386/workspace/workflows/ubuntu/badge.svg)
|
||||
![Workspace](https://github.com/mentos1386/workspace/workflows/workspace/badge.svg)
|
||||
![Packages](https://github.com/mentos1386/workspace/workflows/packages/badge.svg)
|
||||
|
||||
my workspace as a docker container
|
||||
|
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
- name: Prepare
|
||||
id: prepare
|
||||
run: |
|
||||
DOCKER_IMAGE=[[[.repository]]]/workspace-[[[.name]]]
|
||||
DOCKER_IMAGE=[[[.repository]]]/[[[.name]]]
|
||||
DOCKER_PLATFORMS=[[[.platforms]]]
|
||||
VERSION=edge
|
||||
|
||||
|
@ -43,7 +43,7 @@ jobs:
|
|||
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||
${TAGS} --file ./Dockerfile.[[[.name]]] .
|
||||
${TAGS} --file ./[[[.dockerfile]]] .
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
##
|
||||
# Ubuntu
|
||||
[templates."ubuntu-action"]
|
||||
# Workspace
|
||||
[templates."workspace-action"]
|
||||
template = "templates/actions/workspace.yaml.tmpl"
|
||||
|
||||
[templates."ubuntu-action".vars]
|
||||
name = "ubuntu"
|
||||
[templates."workspace-action".vars]
|
||||
name = "workspace"
|
||||
dockerfile = "Dockerfile"
|
||||
repository = "ghcr.io/mentos1386"
|
||||
platforms = "linux/amd64,linux/arm64"
|
||||
|
||||
|
|
Loading…
Reference in a new issue