Dockerfile.armhf 4.6 KB

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