Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build image from Fedora base #36

Merged
merged 10 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions .drone.star
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
def main(ctx):
versions = [
'latest',
'qt512'
'qt512',
'fedora',
]

arches = [
'amd64',
]

# image's base version
# For example, in latest's Dockerfile;
# FROM ubuntu:22.04
# then,
# 'latest': '22.04'
base_img_tag = {
'latest': ['ubuntu', '22.04'],
'fedora': ['fedora', '36'],
}

config = {
'version': 'latest',
'arch': 'amd64',
'trigger': [],
'repo': ctx.repo.name,
'squishversion': {
'latest': '6.7-20220106-1008-qt515x-linux64',
'fedora': '6.7-20220106-1008-qt515x-linux64',
'qt512': '6.7-20210421-1504-qt512x-linux64',
},
'description': 'Squish for ownCloud CI',
Expand All @@ -32,6 +44,17 @@ def main(ctx):
else:
config['path'] = '%s' % config['version']

config['tags'] = [config['version']]
if config['version'] == 'latest':
config['tags'].append('%s-%s' % (base_img_tag[config['version']][0], config['squishversion'][config['version']]))
else:
config['tags'].append('%s-%s' % (config['version'], config['squishversion'][config['version']]))
if config['version'] in base_img_tag:
config['tags'].append(
'%s-%s-%s' % (base_img_tag[config['version']][0], base_img_tag[config['version']][1], config['squishversion'][config['version']])
)


stages.append(docker(config))

after = [
Expand Down Expand Up @@ -188,10 +211,7 @@ def dryrun(config):
},
'settings': {
'dry_run': True,
'tags': [
config['squishversion'][config['version']],
config['version'],
],
'tags': config['tags'],
'dockerfile': '%s/Dockerfile.%s' % (config['path'], config['arch']),
'repo': 'owncloudci/%s' % config['repo'],
'context': config['path'],
Expand Down Expand Up @@ -223,10 +243,7 @@ def publish(config):
'password': {
'from_secret': 'public_password',
},
'tags': [
config['squishversion'][config['version']],
config['version'],
],
'tags': config['tags'],
'dockerfile': '%s/Dockerfile.%s' % (config['path'], config['arch']),
'repo': 'owncloudci/%s' % config['repo'],
'context': config['path'],
Expand Down
186 changes: 186 additions & 0 deletions fedora/Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
ARG BASE=fedora
ARG BASETAG=36

FROM ${BASE}:${BASETAG} as stage-fedora

ENV TZ=Europe/Berlin

LABEL maintainer="https://github.com/owncloud-ci"
LABEL vendor="ownCloud GmbH"
LABEL version="0.1"
LABEL description="minimal Fedora with xfce4, VNC & squish to run GUI tests of the ownCloud desktop client in CI. \
This container is not maintained nor used by froglogic or the Qt company. \
It's not intended for public use but purely for CI runs."

RUN yum install -y \
qt5-qtbase-devel \
qt5-qttools-devel \
qt5-qtsvg \
qtkeychain-qt5-devel \
libcloudproviders-devel \
ffmpeg-free \
wget \
hostname \
nautilus-python\
# to build python3
openssl-devel \
cairo-devel \
gobject-introspection-devel \
cairo-gobject-devel \
# cleanup
&& yum autoremove -y \
&& yum clean all

### install Python 3.8 including needed modules
RUN mkdir /python && \
cd /python && \
wget -O- https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz | tar xz --strip 1 -C . && \
./configure --enable-optimizations --enable-shared --prefix=/usr/local LDFLAGS="-Wl,-rpath /usr/local/lib" && \
make && \
sudo make install && \
cp /python/libpython* /usr/lib && \
python3.8 -m pip install requests && \
python3.8 -m pip install pycairo && \
python3.8 -m pip install PyGObject && \
rm -rf /python

FROM stage-fedora as stage-xfce

RUN yum install -y \
tumbler \
Thunar \
xfce4-appfinder \
xfce4-panel \
xfce4-dev-tools \
xfce4-session \
xfce4-settings \
xfconf \
xfdesktop \
xfwm4 \
dbus-x11 \
xorg-x11-server-Xorg \
xorg-x11-xauth \
langpacks-en \
xterm \
# cleanup
&& yum autoremove -y \
&& yum clean all

ENV \
LANG='en_US.UTF-8' \
LANGUAGE='en_US:en' \
LC_ALL='en_US.UTF-8'

FROM stage-xfce as stage-vnc

### Bintray has been deprecated and disabled since 2021-05-01
RUN wget -qO- https://github.com/accetto/tigervnc/releases/download/v1.10.1-mirror/tigervnc-1.10.1.x86_64.tar.gz | tar xz --strip 1 -C /

FROM stage-vnc as stage-novnc

### same parent path as VNC
ENV NO_VNC_HOME=/usr/share/usr/local/share/noVNCdim

### 'python3-numpy' used for websockify/novnc
### ## Use the older version of websockify to prevent hanging connections on offline containers,
### see https://github.com/ConSol/docker-headless-vnc-container/issues/50
### installed into '/usr/share/usr/local/share/noVNCdim'
RUN yum install -y python3-numpy \
&& mkdir -p ${NO_VNC_HOME}/utils/websockify \
&& wget -qO- https://github.com/novnc/noVNC/archive/v1.2.0.tar.gz | tar xz --strip 1 -C ${NO_VNC_HOME} \
&& wget -qO- https://github.com/novnc/websockify/archive/v0.9.0.tar.gz | tar xz --strip 1 -C ${NO_VNC_HOME}/utils/websockify \
&& chmod +x -v ${NO_VNC_HOME}/utils/*.sh \
### add 'index.html' for choosing noVNC client
&& echo \
"<!DOCTYPE html>\n" \
"<html>\n" \
" <head>\n" \
" <title>noVNC</title>\n" \
" <meta charset=\"utf-8\"/>\n" \
" </head>\n" \
" <body>\n" \
" <p><a href=\"vnc_lite.html\">noVNC Lite Client</a></p>\n" \
" <p><a href=\"vnc.html\">noVNC Full Client</a></p>\n" \
" </body>\n" \
"</html>" \
> ${NO_VNC_HOME}/index.html

FROM stage-novnc as stage-final

# for squish download
ARG S3SECRET
ARG SQUISHVERSION

### download squish
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /opt/mc && \
chmod +x /opt/mc && \
/opt/mc alias set minio https://minio.owncloud.com packages ${S3SECRET} && \
/opt/mc cp --no-color minio/packages/squish/squish-${SQUISHVERSION}.run /opt/squish.run

### Arguments can be provided during build
ARG ARG_HOME
ARG ARG_VNC_BLACKLIST_THRESHOLD
ARG ARG_VNC_BLACKLIST_TIMEOUT
ARG ARG_VNC_PW
ARG ARG_VNC_RESOLUTION
ARG ARG_SUPPORT_USER_GROUP_OVERRIDE

ENV \
DISPLAY=:1 \
HOME=${ARG_HOME:-/home/headless} \
STARTUPDIR=/dockerstartup \
VNC_BLACKLIST_THRESHOLD=${ARG_VNC_BLACKLIST_THRESHOLD:-20} \
VNC_BLACKLIST_TIMEOUT=${ARG_VNC_BLACKLIST_TIMEOUT:-0} \
VNC_COL_DEPTH=24 \
VNC_PORT="5901" \
NO_VNC_PORT="6901" \
VNC_PW=${ARG_VNC_PW:-secret} \
VNC_RESOLUTION=${ARG_VNC_RESOLUTION:-1360x768} \
VNC_VIEW_ONLY=false \
SUPPORT_USER_GROUP_OVERRIDE=${ARG_SUPPORT_USER_GROUP_OVERRIDE}

### Creates home folder
WORKDIR ${HOME}
SHELL ["/bin/bash", "-c"]

COPY [ "./src/startup", "${STARTUPDIR}/" ]

### Preconfigure Xfce
COPY [ "./src/home/Desktop", "${HOME}/Desktop/" ]
COPY [ "./src/home/config/xfce4", "${HOME}/.config/xfce4/" ]
COPY [ "./src/home/config/autostart", "${HOME}/.config/autostart/" ]

### Create the default application user (non-root, but member of the group zero)
### and make '/etc/passwd' and '/etc/group' writable for the group.
### Providing the build argument ARG_SUPPORT_USER_GROUP_OVERRIDE (set to anything) makes both files
### writable for all users, adding support for user group override (like 'run --user x:y').
RUN \
chmod 664 /etc/passwd /etc/group \
&& echo "headless:x:1001:0:Default:${HOME}:/bin/bash" >> /etc/passwd \
# && adduser headless \
&& echo "headless:$VNC_PW" | chpasswd \
&& chmod +x \
"${STARTUPDIR}/set_user_permissions.sh" \
"${STARTUPDIR}/generate_container_user.sh" \
"${STARTUPDIR}/vnc_startup.sh" \
"${STARTUPDIR}/entrypoint.sh" \
"/opt/squish.run" \
&& ${ARG_SUPPORT_USER_GROUP_OVERRIDE/*/chmod a+w /etc/passwd /etc/group} \
&& gtk-update-icon-cache -f /usr/share/icons/*

### Fix permissions
RUN "${STARTUPDIR}"/set_user_permissions.sh "${STARTUPDIR}" "${HOME}"

EXPOSE ${VNC_PORT} ${NO_VNC_PORT}

### Switch to default application user (non-root)
USER 1001

ARG ARG_REFRESHED_AT
ARG ARG_VERSION_STICKER

ENV \
REFRESHED_AT=${ARG_REFRESHED_AT} \
VERSION_STICKER=${ARG_VERSION_STICKER}

ENTRYPOINT [ "/dockerstartup/entrypoint.sh" ]
120 changes: 120 additions & 0 deletions fedora/src/home/Desktop/xfce-display-settings.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
[Desktop Entry]
Version=1.0
Name=Display
Name[ar]=العرض
Name[ast]=Pantalla
Name[be]=Адлюстраванне
Name[bg]=Дисплей
Name[bn]=প্রদর্শন
Name[ca]=Pantalla
Name[cs]=Displej
Name[da]=Skærm
Name[de]=Anzeige
Name[el]=Οθόνη
Name[en_AU]=Display
Name[en_GB]=Display
Name[es]=Pantalla
Name[eu]=Bistaratu
Name[fi]=Näyttö
Name[fr]=Affichage
Name[gl]=Pantalla
Name[he]=תצוגה
Name[hr]=Zaslon
Name[hu]=Kijelző
Name[id]=Tampilan
Name[is]=Skjár
Name[it]=Schermo
Name[ja]=ディスプレイ
Name[kk]=Дисплей
Name[ko]=디스플레이
Name[lt]=Ekranas
Name[lv]=Displejs:
Name[ms]=Paparan
Name[nb]=Skjerm
Name[nl]=Beeldscherm
Name[nn]=Skjerm
Name[oc]=Afichatge
Name[pa]=ਡਿਸਪਲੇਅ
Name[pl]=Ekran
Name[pt]=Ecrã
Name[pt_BR]=Monitor
Name[ro]=Display
Name[ru]=Дисплей
Name[si]=සංදර්ශකය
Name[sk]=Monitor
Name[sl]=Zaslon
Name[sr]=Приказ
Name[sv]=Bildskärm
Name[te]=ప్రదర్శన
Name[th]=จอแสดงผล
Name[tr]=Görüntüle
Name[ug]=كۆرسەتكۈچ
Name[uk]=Дисплей
Name[ur]=ڈسپلے
Name[ur_PK]=ڈسپلے
Name[zh_CN]=显示
Name[zh_HK]=顯示
Name[zh_TW]=顯示
Comment=Configure screen settings and layout
Comment[ar]=ضبط إعدادات الشاشة والتصميم
Comment[ast]=Configura los axustes y la xeometría de la pantalla
Comment[be]=Наладка экрана
Comment[bg]=Конфигуриране на настройките на екрана и оформлението
Comment[bn]=পর্দার সেটিংসমূহ ও বহির্বিন্যাস কনফিগার
Comment[ca]=Configureu els ajusts i la disposició de la pantalla
Comment[cs]=Konfiguruje nastavení obrazovky a rozložení
Comment[da]=Konfigurer skærmindstillinger og layout
Comment[de]=Bildschirmeinstellungen und Anordnung konfigurieren
Comment[el]=Ρύθμιση επιλογών οθόνης και διάταξης
Comment[en_AU]=Configure screen settings and layout
Comment[en_GB]=Configure screen settings and layout
Comment[es]=Configure las opciones y la geometría de la pantalla
Comment[eu]=Konfiguratu pantaila ezarpen eta ingurunea
Comment[fi]=Muokkaa näyttöasetuksia ja asettelua
Comment[fr]=Configurer les paramètres et la disposition des écrans
Comment[gl]=Configurar as opcións e a disposición da pantalla
Comment[he]=הגדרת סידור והגדרות מסך
Comment[hr]=Konfigurirajte postavke i raspored ekrana
Comment[hu]=Képernyő-beállítások és -elrendezés megadása
Comment[id]=Atur pengaturan layar dan tata letak
Comment[is]=Sýsla með skjástillingar og framsetningu
Comment[it]=Configurazione delle impostazioni e della disposizione dello schermo
Comment[ja]=画面の解像度とレイアウトを設定します
Comment[kk]=Экран баптауларын мен жаймасын баптау
Comment[ko]=화면 설정과 배치 설정
Comment[lt]=Konfigūruoti ekrano nustatymus ir išdėstymą
Comment[lv]=Konfigurēt ekrāna uzstādījumus un izkārtojumu
Comment[ms]=Konfigur tetapan dan bentangan skrin
Comment[nb]=Sett opp skjerminnstillinger
Comment[nl]=Scherminstellingen en -vormgeving bewerken
Comment[nn]=Set opp skjermen og utforminga
Comment[oc]=Configurar los paramètres de l'ecran e la disposicion
Comment[pa]=ਸਕਰੀਨ ਸੈਟਿੰਗ ਅਤੇ ਲੇਆਉਟ ਸੰਰਚਨਾ
Comment[pl]=Konfiguruje ustawienia i układ ekranu
Comment[pt]=Configurar definições e esquema do ecrã
Comment[pt_BR]=Definir configurações e disposição dos monitores
Comment[ro]=Configurați opțiunile pentru ecrane și monitoare
Comment[ru]=Настройки экрана
Comment[sk]=Nastavenia konfigurácie obrazovky a rozloženia
Comment[sl]=Nastavite nastavitve zaslona in postavitve
Comment[sr]=Подеси екране и њихов размештај
Comment[sv]=Ställ in skärminställningar och -layout
Comment[te]=తెర అమరికలను మరియు రూపురేఖలను స్వరూపించు
Comment[th]=ตั้งค่าหน้าจอและการจัดเรียง
Comment[tr]=Ekran ayarlarını ve düzenini yapılandırma
Comment[ug]=ئېكراننىڭ ئورۇنلاشتۇرۇلۇشى ۋە ئېنىقلىقىنى تەڭشەش
Comment[uk]=Налаштувати параметри екрану та клавіатури
Comment[ur]=سکرین کی ترتیبات اور خاکہ مرتب کریں
Comment[ur_PK]=سکرین کی ترتیبات اور خاکہ مرتب کریں
Comment[zh_CN]=配置屏幕设置和布局
Comment[zh_HK]=設定螢幕設定值和配置
Comment[zh_TW]=調整螢幕設定值與配置
Exec=xfce4-display-settings
Icon=video-display
Terminal=false
Type=Application
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-HardwareSettings;
StartupNotify=true
OnlyShowIn=XFCE;
X-XfcePluggable=true
X-XfceHelpPage=display
2 changes: 2 additions & 0 deletions fedora/src/home/config/autostart/at-spi-dbus-bus.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Desktop Entry]
Hidden=false
6 changes: 6 additions & 0 deletions fedora/src/home/config/autostart/disable-screensaver.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
Name=disable-screensaver
Comment=Disable screensaver
Terminal=true
Exec=xset s off
3 changes: 3 additions & 0 deletions fedora/src/home/config/autostart/pulseaudio.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Desktop Entry]
Hidden=true

1 change: 1 addition & 0 deletions fedora/src/home/config/xfce4/helpers.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TerminalEmulator=xterm
Loading