diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 00000000..c4f7e0e6 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -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: tiryoh@gmail.com + +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 diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 index f36e07d6..1dace7ee 100644 --- a/Dockerfile.amd64 +++ b/Dockerfile.amd64 @@ -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 \ @@ -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` \ @@ -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 diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 deleted file mode 100644 index 8c12efb0..00000000 --- a/Dockerfile.arm64 +++ /dev/null @@ -1,129 +0,0 @@ -# Built with arch: arm64 flavor: lxde image: ubuntu:18.04 -# -################################################################################ -# base system -################################################################################ - -# qemu helper for arm build -FROM ubuntu:20.04 as amd64 -RUN apt update && apt install -y qemu-user-static -FROM arm64v8/ubuntu:20.04 as system -COPY --from=amd64 /usr/bin/qemu-aarch64-static /usr/bin/ - - - -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 \ - 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 \ - && rm -rf /var/lib/apt/lists/* -# install debs error if combine together -RUN apt update \ - && apt install -y --no-install-recommends --allow-unauthenticated \ - xvfb x11vnc \ - vim-tiny firefox chromium-browser ttf-ubuntu-font-family ttf-wqy-zenhei \ - && add-apt-repository -r ppa:fcwu-tw/apps \ - && apt autoclean -y \ - && apt autoremove -y \ - && 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/* - - -# Additional packages require ~600MB -# libreoffice pinta language-pack-zh-hant language-pack-gnome-zh-hant firefox-locale-zh-hant libreoffice-l10n-zh-tw - -# tini for subreap -ARG TINI_VERSION=v0.18.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-arm64 /bin/tini -RUN chmod +x /bin/tini - -# ffmpeg -RUN apt update \ - && apt install -y --no-install-recommends --allow-unauthenticated \ - ffmpeg \ - && rm -rf /var/lib/apt/lists/* \ - && mkdir /usr/local/ffmpeg \ - && ln -s /usr/bin/ffmpeg /usr/local/ffmpeg/ffmpeg - -# python library -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 \ - && 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` \ - && apt-get autoclean -y \ - && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/cache/apt/* /tmp/a.txt /tmp/b.txt - - -################################################################################ -# builder -################################################################################ -FROM ubuntu:20.04 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 - \ - && apt-get install -y nodejs - -# yarn -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ - && apt-get update \ - && apt-get install -y yarn - -# build frontend -COPY web /src/web -RUN cd /src/web \ - && yarn \ - && yarn build -RUN sed -i 's#app/locale/#novnc/app/locale/#' /src/web/dist/static/novnc/app/ui.js - - -RUN cd /src/web/dist/static/novnc && patch -p0 < /src/web/novnc-armhf-1.patch - - -################################################################################ -# merge -################################################################################ -FROM system -LABEL maintainer="fcwu.tw@gmail.com" - -COPY --from=builder /src/web/dist/ /usr/local/lib/web/frontend/ -COPY rootfs / -RUN ln -sf /usr/local/lib/web/frontend/static/websockify" "/usr/local/lib/web/frontend/static/novnc/utils/websockify && chmod +x /usr/local/lib/web/frontend/static/websockify/run -RUN ln -sf /usr/local/lib/web/frontend/static/websockify /usr/local/lib/web/frontend/static/novnc/utils/websockify && \ - chmod +x /usr/local/lib/web/frontend/static/websockify/run - -EXPOSE 80 -WORKDIR /root -ENV HOME=/home/ubuntu \ - SHELL=/bin/bash -HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health -ENTRYPOINT ["/startup.sh"] diff --git a/Dockerfile.armhf b/Dockerfile.armhf deleted file mode 100644 index 561bb779..00000000 --- a/Dockerfile.armhf +++ /dev/null @@ -1,124 +0,0 @@ -# Built with arch: armhf flavor: lxde image: ubuntu:18.04 -# -################################################################################ -# base system -################################################################################ - -# qemu helper for arm build -FROM ubuntu:18.04 as amd64 -RUN apt update && apt install -y qemu-user-static -FROM arm32v7/ubuntu:18.04 as system -COPY --from=amd64 /usr/bin/qemu-arm-static /usr/bin/ - - - -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 \ - 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 \ - && rm -rf /var/lib/apt/lists/* -# install debs error if combine together -RUN add-apt-repository -y ppa:fcwu-tw/apps \ - && apt update \ - && apt install -y --no-install-recommends --allow-unauthenticated \ - xvfb x11vnc=0.9.16-1 \ - vim-tiny firefox chromium-browser ttf-ubuntu-font-family ttf-wqy-zenhei \ - && add-apt-repository -r ppa:fcwu-tw/apps \ - && apt autoclean -y \ - && apt autoremove -y \ - && 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/* - - -# Additional packages require ~600MB -# libreoffice pinta language-pack-zh-hant language-pack-gnome-zh-hant firefox-locale-zh-hant libreoffice-l10n-zh-tw - -# tini for subreap -ARG TINI_VERSION=v0.18.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-armhf /bin/tini -RUN chmod +x /bin/tini - -# ffmpeg -RUN mkdir -p /usr/local/ffmpeg \ - && curl -sSL https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz | tar xJvf - -C /usr/local/ffmpeg/ --strip 1 - -# python library -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 python-pip python-dev build-essential \ - && pip install setuptools wheel && pip install -r /tmp/requirements.txt \ - && 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` \ - && apt-get autoclean -y \ - && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/cache/apt/* /tmp/a.txt /tmp/b.txt - - -################################################################################ -# builder -################################################################################ -FROM ubuntu:18.04 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 - \ - && apt-get install -y nodejs - -# yarn -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ - && apt-get update \ - && apt-get install -y yarn - -# build frontend -COPY web /src/web -RUN cd /src/web \ - && yarn \ - && yarn run build -RUN sed -i 's#app/locale/#novnc/app/locale/#' /src/web/dist/static/novnc/app/ui.js - -RUN cd /src/web/dist/static/novnc && patch -p0 < /src/web/novnc-armhf-1.patch - - -################################################################################ -# merge -################################################################################ -FROM system -LABEL maintainer="fcwu.tw@gmail.com" - -COPY --from=builder /src/web/dist/ /usr/local/lib/web/frontend/ -COPY rootfs / -RUN ln -sf /usr/local/lib/web/frontend/static/websockify" "/usr/local/lib/web/frontend/static/novnc/utils/websockify && chmod +x /usr/local/lib/web/frontend/static/websockify/run -RUN ln -sf /usr/local/lib/web/frontend/static/websockify /usr/local/lib/web/frontend/static/novnc/utils/websockify && \ - chmod +x /usr/local/lib/web/frontend/static/websockify/run - -EXPOSE 80 -WORKDIR /root -ENV HOME=/home/ubuntu \ - SHELL=/bin/bash -HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health -ENTRYPOINT ["/startup.sh"] diff --git a/Dockerfile.j2 b/Dockerfile.j2 index 7b339d07..2e25b941 100644 --- a/Dockerfile.j2 +++ b/Dockerfile.j2 @@ -5,38 +5,45 @@ ################################################################################ {%if arch == "amd64"%} FROM {{image}} as system -{%elif arch == "armhf"%} +{%elif arch == "arm64"%} # qemu helper for arm build -FROM {{image}} as amd64 -RUN apt update && apt install -y qemu-user-static -FROM arm32v7/{{image}} as system -COPY --from=amd64 /usr/bin/qemu-arm-static /usr/bin/ +FROM --platform=amd64 {{image}} as amd64 +RUN apt-get update && apt-get install -y qemu-user-static +FROM --platform=arm64 {{image}} as system +COPY --from=amd64 /usr/bin/qemu-aarch64-static /usr/bin/ {%endif%} +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 \ @@ -48,23 +55,29 @@ RUN apt update \ {%endif%} {%if desktop == "xfce4" %} {%endif%} -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 \ +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 \ @@ -75,7 +88,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` \ @@ -88,7 +101,11 @@ RUN apt-get update \ ################################################################################ # builder ################################################################################ +{%if arch == "arm64"%} +FROM --platform=arm64 {{image}} as builder +{%else%} FROM {{image}} as builder +{%endif%} {% if localbuild == 1 %} RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; @@ -98,7 +115,7 @@ 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 diff --git a/Makefile b/Makefile index d5094392..2ff67243 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,22 @@ REPO ?= dorowu/ubuntu-desktop-lxde-vnc TAG ?= latest # you can choose other base image versions -IMAGE ?= ubuntu:20.04 +IMAGE ?= ubuntu:jammy-20220531 # IMAGE ?= nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 # choose from supported flavors (see available ones in ./flavors/*.yml) FLAVOR ?= lxde -# armhf or amd64 +# arm64 or amd64 ARCH ?= amd64 +# apt source +LOCALBUILD ?= 0 # These files will be generated from teh Jinja templates (.j2 sources) templates = Dockerfile rootfs/etc/supervisor/conf.d/supervisord.conf # Rebuild the container image build: $(templates) - docker build -t $(REPO):$(TAG) . + cp Dockerfile Dockerfile.$(ARCH) + docker build -t $(REPO):$(TAG) -f Dockerfile.$(ARCH) . # Test run the container # the local dir will be mounted under /src read-only @@ -53,7 +56,7 @@ extra-clean: # Run jinja2cli to parse Jinja template applying rules defined in the flavors definitions %: %.j2 flavors/$(FLAVOR).yml - docker run -v $(shell pwd):/data vikingco/jinja2cli \ + docker run --rm -v $(shell pwd):/data vikingco/jinja2cli \ -D flavor=$(FLAVOR) \ -D image=$(IMAGE) \ -D localbuild=$(LOCALBUILD) \ diff --git a/rootfs/etc/nginx/sites-enabled/default b/rootfs/etc/nginx/sites-enabled/default index b6afe519..3ae9ef97 100644 --- a/rootfs/etc/nginx/sites-enabled/default +++ b/rootfs/etc/nginx/sites-enabled/default @@ -18,7 +18,7 @@ server { #_RELATIVE_URL_ROOT_ root /usr/local/lib/web/frontend/; #_RELATIVE_URL_ROOT_} - location ~ .*/(api/.*|websockify) { + location ~ .*/(api/.*|websockify|resize) { try_files $uri @api$http_upgrade; } diff --git a/rootfs/etc/supervisor/conf.d/supervisord.conf.j2 b/rootfs/etc/supervisor/conf.d/supervisord.conf.j2 index 36befd5b..cc09457b 100644 --- a/rootfs/etc/supervisor/conf.d/supervisord.conf.j2 +++ b/rootfs/etc/supervisor/conf.d/supervisord.conf.j2 @@ -38,6 +38,7 @@ priority=15 directory=%HOME% command=/usr/bin/pcmanfm --desktop --profile LXDE user=%USER% +stopwaitsecs=3 environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%" {% endif %} diff --git a/rootfs/usr/local/lib/web/backend/requirements.txt b/rootfs/usr/local/lib/web/backend/requirements.txt index 0590bd42..5f937b8c 100644 --- a/rootfs/usr/local/lib/web/backend/requirements.txt +++ b/rootfs/usr/local/lib/web/backend/requirements.txt @@ -1,19 +1,19 @@ backports.ssl-match-hostname==3.7.0.1 -certifi==2019.9.11 -chardet==3.0.4 -Click==7.0 -Flask==1.1.1 -Flask-Login==0.4.1 -gevent==1.4.0 +certifi==2022.5.18.1 +chardet==4.0.0 +Click==8.1.3 +Flask==2.1.2 +Flask-Login==0.6.1 +gevent==21.12.0 gevent-websocket==0.10.1 -greenlet==0.4.15 +greenlet==1.1.2 idna==2.8 -itsdangerous==1.1.0 -Jinja2==2.11.3 -MarkupSafe==1.1.1 -meld3==2.0.0 -requests==2.22.0 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.1 +meld3==2.0.1 +requests==2.27.1 six==1.12.0 -urllib3==1.25.6 -websocket-client==0.47.0 -Werkzeug==0.16.0 +urllib3==1.26.9 +websocket-client==1.3.2 +Werkzeug==2.1.2