feat(docker): give fedora a try

This commit is contained in:
Tine Jozelj 2020-12-21 18:06:30 +01:00
parent e5024f8b8a
commit cce55948e1
No known key found for this signature in database
GPG key ID: 3818B74E3830D7CF
5 changed files with 129 additions and 5 deletions

BIN
.Dockerfile.fedora.swp Normal file

Binary file not shown.

76
.github/workflows/fedora.yaml vendored Normal file
View file

@ -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 }}

View file

@ -1,4 +1,4 @@
name: buildx name: Ubuntu
on: on:
schedule: schedule:
@ -11,7 +11,7 @@ on:
- v* - v*
jobs: jobs:
buildx: ubuntu:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -19,7 +19,7 @@ jobs:
- name: Prepare - name: Prepare
id: prepare id: prepare
run: | run: |
DOCKER_IMAGE=ghcr.io/mentos1386/env DOCKER_IMAGE=ghcr.io/mentos1386/env/ubuntu
DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64 DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64
VERSION=edge VERSION=edge

48
Dockerfile.fedora Normal file
View file

@ -0,0 +1,48 @@
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
FROM fedora:33
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
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"]

View file

@ -6,6 +6,8 @@ LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
ARG SSH_USER="${SSH_USER:-blink}" ARG SSH_USER="${SSH_USER:-blink}"
ARG SSH_PASSWORD="${SSH_PASSWORD:-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 LANG en_US.UTF-8
ENV LANGUAGE en_US:en ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8 ENV LC_ALL en_US.UTF-8
@ -24,8 +26,6 @@ RUN set -ueox pipefail \
psmisc \ psmisc \
tmux \ tmux \
vim \ vim \
&& 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}" \
&& echo -e "${SSH_PASSWORD}\n${SSH_PASSWORD}" | passwd "${SSH_USER}" \ && echo -e "${SSH_PASSWORD}\n${SSH_PASSWORD}" | passwd "${SSH_USER}" \
&& apt-get -yqq clean all \ && apt-get -yqq clean all \