diff --git a/.Dockerfile.fedora.swp b/.Dockerfile.fedora.swp new file mode 100644 index 0000000..761d92d Binary files /dev/null and b/.Dockerfile.fedora.swp differ 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 \