From cce55948e12ddc869ac3395aeea624910be6b415 Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Mon, 21 Dec 2020 18:06:30 +0100 Subject: [PATCH] feat(docker): give fedora a try --- .Dockerfile.fedora.swp | Bin 0 -> 12288 bytes .github/workflows/fedora.yaml | 76 ++++++++++++++++++ .../workflows/{buildx.yaml => ubuntu.yaml} | 6 +- Dockerfile.fedora | 48 +++++++++++ Dockerfile.ubuntu | 4 +- 5 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 .Dockerfile.fedora.swp create mode 100644 .github/workflows/fedora.yaml rename .github/workflows/{buildx.yaml => ubuntu.yaml} (97%) create mode 100644 Dockerfile.fedora diff --git a/.Dockerfile.fedora.swp b/.Dockerfile.fedora.swp new file mode 100644 index 0000000000000000000000000000000000000000..761d92d09c868e7cffa125b8f46d32be679aa9dc GIT binary patch literal 12288 zcmeI2O>Epm6vrnVDhia3mIH8_I;aH{?<5-uMXRO|nuUUrY_v<7rU_bk?eW@)*W-G| z`6vnHz?lPAs8CNFIB|kI2acS$ap1rW^@s!~_>aBbBxTc7fdiGs(%&7=EN3vLqGj+*OkC zc$3WvcY~*X81ahFJ&`)cxG>#@fFW=a0-5sdsWVHH)roO^`>1uEo;$mA5>MtHL%=#gTj&%hZmqz&~KR29<&QBLvKL$9w+23^d)2tL%U{Qu#l>=-~kI<^yVFIW|i4u5W5Uu?AMv|1gn zR$1mH`wdLF30Z2@n=}-Lpg51nI1@+v6Lr5KEOvAL4?@lP=}sSdf%-qqVI=2Y~({T zdPslP&>;`tD&s2_CK6=W$o(Y@n0gIA#L%jjZ8Lq!pUm(e4s@@PBHOG357i?1U~V9` zfUZdo_SFvB4UM>jYLP3A#T8n4un{A9mZZqO)TanMVXslP>7+$9@AP6HDa4(a>f|rd ziX%ECYZ=?(OslorXwL4f#YKRF1`COvI8ttTrEQ+LC49&8GRadU=glnS3T2nOLeh&D zb-squ=|tSKa|a^z(1sh@d|RbXyPJwEL1G;uvesX*I)}@;#yz-5WG|HN;8G+!#{1ev z44Vj}yrm~(Ft~^WRz22b+37mA%TpElp^J6C->#QhK}Qp_cW4;n^)NuzZ!F#pFw_Yp z^^`L%wrLV3+;>9Fm$a_d=jQYmM}KTOjtuhGwu=u5nQ6X5_3AJAPWPu@Uf1kS6vi8S z*1%HZF0FKZ--67|yj7p0JtvG6#M5c(eH8RkkH<>LiOH$gFVpwLEgr4YOM2t{n|hnQ zOdOYAMvlJSY|PVQ%Y1Eel8owiSS_EC&trEw-|b74oUT&2rB8Vk^YzvA{+@eUBYy*C CGGJ{0 literal 0 HcmV?d00001 diff --git a/.github/workflows/fedora.yaml b/.github/workflows/fedora.yaml new file mode 100644 index 0000000..235fe8c --- /dev/null +++ b/.github/workflows/fedora.yaml @@ -0,0 +1,76 @@ +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/env/fedora + DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,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 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Set up Docker Buildx + id: 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/.github/workflows/buildx.yaml b/.github/workflows/ubuntu.yaml similarity index 97% rename from .github/workflows/buildx.yaml rename to .github/workflows/ubuntu.yaml index c31a920..b66075d 100644 --- a/.github/workflows/buildx.yaml +++ b/.github/workflows/ubuntu.yaml @@ -1,4 +1,4 @@ -name: buildx +name: Ubuntu on: schedule: @@ -11,7 +11,7 @@ on: - v* jobs: - buildx: + ubuntu: runs-on: ubuntu-latest steps: - name: Checkout @@ -19,7 +19,7 @@ jobs: - name: Prepare id: prepare run: | - DOCKER_IMAGE=ghcr.io/mentos1386/env + DOCKER_IMAGE=ghcr.io/mentos1386/env/ubuntu DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64 VERSION=edge diff --git a/Dockerfile.fedora b/Dockerfile.fedora new file mode 100644 index 0000000..98540ca --- /dev/null +++ b/Dockerfile.fedora @@ -0,0 +1,48 @@ +# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile : +FROM fedora:33 + +LABEL maintainer="Tine Jozelj " + +ARG SSH_USER="${SSH_USER:-blink}" +ARG SSH_PASSWORD="${SSH_PASSWORD:-blink}" + +RUN dnf -y update + +SHELL ["/bin/bash", "-c"] + +RUN set -ueox pipefail \ +&& dnf -y update \ +&& dnf -y 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}" \ +&& dnf clean all \ +&& rm -rf /tmp/* /var/tmp/* + +COPY . "/home/${SSH_USER}/.dotfiles"/ +RUN chown -R "${SSH_USER}:${SSH_USER}" "/home/${SSH_USER}/.dotfiles" + +USER "${SSH_USER}" + +RUN ln -s "/home/${SSH_USER}/.dotfiles/tmux/tmux.conf" "/home/${SSH_USER}/.tmux.conf" \ +&& 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" + +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 8536008..37d0531 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -6,6 +6,8 @@ LABEL maintainer="Tine Jozelj " 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 @@ -24,8 +26,6 @@ RUN set -ueox pipefail \ psmisc \ tmux \ vim \ -&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \ -&& locale-gen \ && 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 \