Dockerfile.my 5.3 KB

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