Dockerfile.arm64 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # Built with arch: arm64 flavor: lxde image: ubuntu:18.04
  2. #
  3. ################################################################################
  4. # base system
  5. ################################################################################
  6. # qemu helper for arm build
  7. FROM ubuntu:20.04 as amd64
  8. RUN apt update && apt install -y qemu-user-static
  9. FROM arm64v8/ubuntu:20.04 as system
  10. COPY --from=amd64 /usr/bin/qemu-aarch64-static /usr/bin/
  11. RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
  12. # built-in packages
  13. ENV DEBIAN_FRONTEND noninteractive
  14. RUN apt update \
  15. && apt install -y --no-install-recommends software-properties-common curl apache2-utils \
  16. && apt update \
  17. && apt install -y --no-install-recommends --allow-unauthenticated \
  18. supervisor nginx sudo net-tools zenity xz-utils \
  19. dbus-x11 x11-utils alsa-utils \
  20. mesa-utils libgl1-mesa-dri \
  21. && apt autoclean -y \
  22. && apt autoremove -y \
  23. && rm -rf /var/lib/apt/lists/*
  24. # install debs error if combine together
  25. RUN apt update \
  26. && apt install -y --no-install-recommends --allow-unauthenticated \
  27. xvfb x11vnc \
  28. vim-tiny firefox chromium-browser ttf-ubuntu-font-family ttf-wqy-zenhei \
  29. && add-apt-repository -r ppa:fcwu-tw/apps \
  30. && apt autoclean -y \
  31. && apt autoremove -y \
  32. && rm -rf /var/lib/apt/lists/*
  33. RUN apt update \
  34. && apt install -y --no-install-recommends --allow-unauthenticated \
  35. lxde gtk2-engines-murrine gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \
  36. && apt autoclean -y \
  37. && apt autoremove -y \
  38. && rm -rf /var/lib/apt/lists/*
  39. # Additional packages require ~600MB
  40. # libreoffice pinta language-pack-zh-hant language-pack-gnome-zh-hant firefox-locale-zh-hant libreoffice-l10n-zh-tw
  41. # tini for subreap
  42. ARG TINI_VERSION=v0.18.0
  43. ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-arm64 /bin/tini
  44. RUN chmod +x /bin/tini
  45. # ffmpeg
  46. RUN apt update \
  47. && apt install -y --no-install-recommends --allow-unauthenticated \
  48. ffmpeg \
  49. && rm -rf /var/lib/apt/lists/* \
  50. && mkdir /usr/local/ffmpeg \
  51. && ln -s /usr/bin/ffmpeg /usr/local/ffmpeg/ffmpeg
  52. # python library
  53. COPY rootfs/usr/local/lib/web/backend/requirements.txt /tmp/
  54. RUN apt-get update \
  55. && dpkg-query -W -f='${Package}\n' > /tmp/a.txt \
  56. && apt-get install -y python3-pip python3-dev build-essential \
  57. && pip3 install setuptools wheel && pip3 install -r /tmp/requirements.txt \
  58. && ln -s /usr/bin/python3 /usr/local/bin/python \
  59. && dpkg-query -W -f='${Package}\n' > /tmp/b.txt \
  60. && apt-get remove -y `diff --changed-group-format='%>' --unchanged-group-format='' /tmp/a.txt /tmp/b.txt | xargs` \
  61. && apt-get autoclean -y \
  62. && apt-get autoremove -y \
  63. && rm -rf /var/lib/apt/lists/* \
  64. && rm -rf /var/cache/apt/* /tmp/a.txt /tmp/b.txt
  65. ################################################################################
  66. # builder
  67. ################################################################################
  68. FROM ubuntu:20.04 as builder
  69. RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
  70. RUN apt-get update \
  71. && apt-get install -y --no-install-recommends curl ca-certificates gnupg patch
  72. # nodejs
  73. RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
  74. && apt-get install -y nodejs
  75. # yarn
  76. RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
  77. && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
  78. && apt-get update \
  79. && apt-get install -y yarn
  80. # build frontend
  81. COPY web /src/web
  82. RUN cd /src/web \
  83. && yarn \
  84. && yarn build
  85. RUN sed -i 's#app/locale/#novnc/app/locale/#' /src/web/dist/static/novnc/app/ui.js
  86. RUN cd /src/web/dist/static/novnc && patch -p0 < /src/web/novnc-armhf-1.patch
  87. ################################################################################
  88. # merge
  89. ################################################################################
  90. FROM system
  91. LABEL maintainer="fcwu.tw@gmail.com"
  92. COPY --from=builder /src/web/dist/ /usr/local/lib/web/frontend/
  93. COPY rootfs /
  94. 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
  95. RUN ln -sf /usr/local/lib/web/frontend/static/websockify /usr/local/lib/web/frontend/static/novnc/utils/websockify && \
  96. chmod +x /usr/local/lib/web/frontend/static/websockify/run
  97. EXPOSE 80
  98. WORKDIR /root
  99. ENV HOME=/home/ubuntu \
  100. SHELL=/bin/bash
  101. HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health
  102. ENTRYPOINT ["/startup.sh"]