diff --git a/.github/workflows/fedora.yaml b/.github/workflows/fedora.yaml deleted file mode 100644 index 46d0673..0000000 --- a/.github/workflows/fedora.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: fedora - -on: - schedule: - - cron: '0 6 * * *' - pull_request: - branches: main - push: - branches: main - tags: - - v* - -jobs: - fedora: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Prepare - id: prepare - run: | - DOCKER_IMAGE=ghcr.io/mentos1386/workspace-fedora - DOCKER_PLATFORMS=linux/amd64,linux/arm64 - VERSION=edge - - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/v} - fi - if [ "${{ github.event_name }}" = "schedule" ]; then - VERSION=nightly - fi - - TAGS="--tag ${DOCKER_IMAGE}:${VERSION}" - if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest" - fi - - 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 VERSION=${VERSION} \ - --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --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.fedora . - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-fedora-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-fedora- - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Docker Buildx (build) - run: | - docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} - - name: Login to Github Registry - if: success() && github.event_name != 'pull_request' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.CR_PAT }} - - name: Docker Buildx (push) - if: success() && github.event_name != 'pull_request' - run: | - docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} - - name: Inspect image - if: always() && github.event_name != 'pull_request' - run: | - docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} - diff --git a/Dockerfile.fedora b/Dockerfile.fedora deleted file mode 100644 index baa19e3..0000000 --- a/Dockerfile.fedora +++ /dev/null @@ -1,70 +0,0 @@ -# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile : -FROM fedora:33 - -LABEL maintainer="Tine Jozelj " -LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace - -ARG SSH_USER="${SSH_USER:-tine}" - -SHELL ["/bin/bash", "-c"] - -RUN set -ueox pipefail \ -&& dnf -y update \ -&& dnf -y install \ - ca-certificates \ - mosh \ - openssh-server \ - psmisc \ - util-linux-user \ -&& adduser "${SSH_USER}" \ -&& dnf clean all \ -&& rm -rf /tmp/* /var/tmp/* - -# Install available packages -RUN set -ueox pipefail \ -&& dnf -y update \ -&& dnf -y install \ - git \ - tmux \ - vim \ - zsh \ -&& dnf clean all \ -&& rm -rf /tmp/* /var/tmp/* - -# Install other packages -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 - -# Create .dotfiles -COPY --chown=${SSH_USER}:${SSH_USER} dotfiles /home/${SSH_USER}/.dotfiles - -# Set ZSH for SSH_USER -RUN chsh -s $(which zsh) ${SSH_USER} - -# 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" \ -&& vim -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"] - diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 6ed9faf..42e7e04 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -5,10 +5,7 @@ LABEL maintainer="Tine Jozelj " LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace ARG SSH_USER="${SSH_USER:-blink}" -ARG SSH_PASSWORD="${SSH_PASSWORD:-blink}" -RUN apt update && apt install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 @@ -19,38 +16,64 @@ RUN set -ueox pipefail \ && DEBIAN_FRONTEND=noninteractive \ && apt-get -yqq update \ && apt-get -yqq --no-install-recommends --no-install-suggests install \ - git \ ca-certificates \ locales \ mosh \ openssh-server \ psmisc \ - tmux \ - vim \ && adduser --quiet --gecos '' --disabled-password --add_extra_groups "${SSH_USER}" \ -&& echo -e "${SSH_PASSWORD}\n${SSH_PASSWORD}" | passwd "${SSH_USER}" \ && apt-get -yqq clean all \ && rm -rf /var/lib/apt/lists/* \ /tmp/* \ /var/tmp/* -COPY . "/home/${SSH_USER}/.dotfiles"/ -RUN chown -R "${SSH_USER}:${SSH_USER}" "/home/${SSH_USER}/.dotfiles" +# Install available packages +RUN set -ueox pipefail \ +&& DEBIAN_FRONTEND=noninteractive \ +&& 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 +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 + +# Create .dotfiles +COPY --chown=${SSH_USER}:${SSH_USER} dotfiles /home/${SSH_USER}/.dotfiles + +# Set ZSH for SSH_USER +RUN chsh -s $(which zsh) ${SSH_USER} + +# User Configuration USER "${SSH_USER}" -RUN ln -s "/home/${SSH_USER}/.dotfiles/tmux/tmux.conf" "/home/${SSH_USER}/.tmux.conf" \ -&& mkdir -p "/home/${SSH_USER}/.config" \ +# 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" \ && vim -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"] diff --git a/Makefile b/Makefile index 7434c3e..469e2a0 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,3 @@ - -.PHONY: build-fedora -build-fedora: - @docker buildx build --load -t env-fedora -f Dockerfile.fedora . - .PHONY: build-ubuntu build-ubuntu: @docker buildx build --load -t env-ubuntu -f Dockerfile.ubuntu . @@ -18,20 +13,18 @@ build-package-kubectl: .PHONY: build-packages build-packages: package-kubectl package-starship -build: packages fedora ubuntu +build: packages ubuntu .PHONY: template 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 fedora-action > .github/workflows/fedora.yaml pull: - @docker pull ghcr.io/mentos1386/workspace-fedora:edge - #@docker pull ghcr.io/mentos1386/workspace-ubuntu:edge + @docker pull ghcr.io/mentos1386/workspace-ubuntu:edge @docker pull ghcr.io/mentos1386/starship:0.47.0 @docker pull ghcr.io/mentos1386/kubectl:1.20.0 -run-fedora: - @docker run -it --rm --workdir /home/tine --user tine ghcr.io/mentos1386/workspace-fedora:edge zsh +run-ubuntu: + @docker run -it --rm --workdir /home/tine --user tine ghcr.io/mentos1386/workspace-ubuntu:edge zsh diff --git a/README.md b/README.md index b1a81ab..629b7f8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ ![Ubuntu](https://github.com/mentos1386/workspace/workflows/ubuntu/badge.svg) -![Fedora](https://github.com/mentos1386/workspace/workflows/fedora/badge.svg) ![Packages](https://github.com/mentos1386/workspace/workflows/packages/badge.svg) my workspace as a docker container diff --git a/workspace.toml b/workspace.toml index 8342103..9345979 100644 --- a/workspace.toml +++ b/workspace.toml @@ -1,13 +1,3 @@ -## -# Fedora -[templates."fedora-action"] -template = "templates/actions/workspace.yaml.tmpl" - -[templates."fedora-action".vars] -name = "fedora" -repository = "ghcr.io/mentos1386" -platforms = "linux/amd64,linux/arm64" - ## # Ubuntu [templates."ubuntu-action"]