Skip to content

Commit

Permalink
Add Ubuntu 22.04 (#1)
Browse files Browse the repository at this point in the history
* fix: Re-enable /resize URI

* Update for Ubuntu 22.04 (WIP)

LXDE shows "Failed to close file descriptor for child process" error

* fix: Fix noVNC launch error

* ci: Add GitHub Actions config

* fix: Fix arm64 execution error

qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

* ci: Fix config

* chore: Clean-up Makefile

* ci: Fix submodule clone error
  • Loading branch information
Tiryoh authored Jul 26, 2022
1 parent e4922ce commit 512df7c
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 337 deletions.
124 changes: 124 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Deploy
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:

env:
DOCKER_USERNAME: tiryoh
DOCKER_IMAGENAME: ubuntu-desktop-lxde-vnc
GIT_CONFIG_USER: Tiryoh@GitHubActions
GIT_CONFIG_EMAIL: [email protected]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
distro:
- jammy

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Setup QEMU
uses: docker/setup-qemu-action@v1

- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to docker.io
uses: docker/login-action@v1
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Prepare Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ env.DOCKER_USERNAME }}/${{ env.DOCKER_IMAGENAME }}
tags: |
type=raw,value=${{ matrix.distro }}
type=raw,value=${{ matrix.distro }}-{{date 'YYYYMMDDTHHmm'}}
flavor: |
latest=${{ matrix.distro == 'jammy' }}
prefix=
suffix=
- name: Build and Publish
id: docker-build
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64, linux/arm64
outputs: type=registry # same as --push, push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Get Current Job Log URL
id: jobs
uses: Tiryoh/gha-jobid-action@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
job_name: build-and-deploy (${{ matrix.distro }})

- name: Update wiki
env:
DOCKER_TAGNAME: ${{ matrix.distro }}
run: |
DOCKER_SNAPSHOT=$(cat << EOF | grep ".*-.*T.*" | sed -E "s/.*:(.*-[0-9]*T[0-9])/\1/g"
${{ steps.meta.outputs.tags }}
EOF)
echo $DOCKER_SNAPSHOT
DOCKER_DIGEST=${{ steps.docker-build.outputs.digest }}
echo $DOCKER_DIGEST
DOCKER_DIGEST_SHORT=$(echo ${DOCKER_DIGEST} | sed -E 's/.*([0-9a-z]{12})[0-9a-z]{52}$/\1/g')
echo $DOCKER_DIGEST_SHORT
DOCKER_SNAPSHOT_IMAGE_HISTORY_URL=$(echo "https://hub.docker.com/r/${DOCKER_USERNAME}/${DOCKER_IMAGENAME}/tags?page=1&name=${DOCKER_SNAPSHOT}")
git clone --depth=1 https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.wiki.git wiki
cd wiki
LINE=$(grep -n "add ${{ matrix.distro }} msg after this line" ${{ matrix.distro }}.md | cut -d ":" -f 1)
head -n $LINE ${{ matrix.distro }}.md > tmp.md
echo "* \`${DOCKER_DIGEST_SHORT}\`" | tee -a tmp.md
echo " * uploaded on $(date --iso-8601="minutes")" | tee -a tmp.md
echo " * ${{ steps.jobs.outputs.html_url }}" | tee -a tmp.md
echo " * snapshot" | tee -a tmp.md
echo " * [\`${DOCKER_SNAPSHOT}\`](${DOCKER_SNAPSHOT_IMAGE_HISTORY_URL})" | tee -a tmp.md
tail -n +$(( $LINE+1 )) ${{ matrix.distro }}.md >> tmp.md
mv tmp.md ${{ matrix.distro }}.md
git config --local user.email "${GIT_CONFIG_EMAIL}"
git config --local user.name "${GIT_CONFIG_USER}"
git add ${{ matrix.distro }}.md
git commit -m "Update ${{ matrix.distro }}.md"
git fetch origin && git merge origin/master --no-edit && git push origin master || \
git fetch origin && git merge origin/master --no-edit && git push origin master
77 changes: 44 additions & 33 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -1,64 +1,75 @@
# Built with arch: amd64 flavor: lxde image: ubuntu:20.04
# Built with arch: amd64 flavor: lxde image: ubuntu:jammy-20220531
#
################################################################################
# base system
################################################################################

FROM ubuntu:20.04 as system
FROM ubuntu:jammy-20220531 as system


ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;


# built-in packages
ENV DEBIAN_FRONTEND noninteractive
RUN apt update \
&& apt install -y --no-install-recommends software-properties-common curl apache2-utils \
&& apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
RUN apt-get update \
&& apt-get install -y --no-install-recommends software-properties-common curl apache2-utils \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
supervisor nginx sudo net-tools zenity xz-utils \
dbus-x11 x11-utils alsa-utils \
mesa-utils libgl1-mesa-dri \
&& apt autoclean -y \
&& apt autoremove -y \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# install debs error if combine together
RUN apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
xvfb x11vnc \
vim-tiny firefox ttf-ubuntu-font-family ttf-wqy-zenhei \
&& apt autoclean -y \
&& apt autoremove -y \
vim-tiny firefox fonts-ubuntu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

RUN apt update \
&& apt install -y gpg-agent \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gpgconf gnupg gpg-agent \
&& curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& (dpkg -i ./google-chrome-stable_current_amd64.deb || apt-get install -fy) \
&& curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add \
&& rm google-chrome-stable_current_amd64.deb \
&& rm -rf /var/lib/apt/lists/*

RUN apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
lxde gtk2-engines-murrine gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*



RUN apt-get update \
&& apt-get install -y --no-install-recommends \
lightdm \
&& apt-get install -y \
lxde \
&& apt-get install -y --no-install-recommends \
gtk2-engines-murrine gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Additional packages require ~600MB
# libreoffice pinta language-pack-zh-hant language-pack-gnome-zh-hant firefox-locale-zh-hant libreoffice-l10n-zh-tw

# tini to fix subreap
ARG TINI_VERSION=v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/tini
RUN chmod +x /bin/tini
RUN apt-get update \
&& apt-get install -y --no-install-recommends tini \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

# ffmpeg
RUN apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /usr/local/ffmpeg \
Expand All @@ -69,7 +80,7 @@ COPY rootfs/usr/local/lib/web/backend/requirements.txt /tmp/
RUN apt-get update \
&& dpkg-query -W -f='${Package}\n' > /tmp/a.txt \
&& apt-get install -y python3-pip python3-dev build-essential \
&& pip3 install setuptools wheel && pip3 install -r /tmp/requirements.txt \
&& python3 -m pip install setuptools wheel && python3 -m pip install -r /tmp/requirements.txt \
&& ln -s /usr/bin/python3 /usr/local/bin/python \
&& dpkg-query -W -f='${Package}\n' > /tmp/b.txt \
&& apt-get remove -y `diff --changed-group-format='%>' --unchanged-group-format='' /tmp/a.txt /tmp/b.txt | xargs` \
Expand All @@ -82,17 +93,17 @@ RUN apt-get update \
################################################################################
# builder
################################################################################
FROM ubuntu:20.04 as builder

FROM ubuntu:jammy-20220531 as builder


RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;


RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates gnupg patch

# nodejs
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs

# yarn
Expand Down
129 changes: 0 additions & 129 deletions Dockerfile.arm64

This file was deleted.

Loading

0 comments on commit 512df7c

Please sign in to comment.