| 
 | 1 | +# Built with arch: amd64 flavor: lxde image: ubuntu:18.04  | 
 | 2 | +#  | 
 | 3 | +################################################################################  | 
 | 4 | +# base system  | 
 | 5 | +################################################################################  | 
 | 6 | + | 
 | 7 | +FROM ubuntu:18.04 as system  | 
 | 8 | + | 
 | 9 | + | 
 | 10 | +RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;   | 
 | 11 | + | 
 | 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 | + | 
 | 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 | + && apt autoclean -y \  | 
 | 39 | + && apt autoremove -y \  | 
 | 40 | + && rm -rf /var/lib/apt/lists/*  | 
 | 41 | +   | 
 | 42 | +   | 
 | 43 | +   | 
 | 44 | +# Additional packages require ~600MB  | 
 | 45 | +# libreoffice pinta language-pack-zh-hant language-pack-gnome-zh-hant firefox-locale-zh-hant libreoffice-l10n-zh-tw  | 
 | 46 | + | 
 | 47 | +# tini for subreap  | 
 | 48 | +ARG TINI_VERSION=v0.18.0  | 
 | 49 | +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-amd64 /bin/tini  | 
 | 50 | +RUN chmod +x /bin/tini  | 
 | 51 | + | 
 | 52 | +# ffmpeg  | 
 | 53 | +RUN apt update \  | 
 | 54 | + && apt install -y --no-install-recommends --allow-unauthenticated \  | 
 | 55 | + ffmpeg \  | 
 | 56 | + && rm -rf /var/lib/apt/lists/* \  | 
 | 57 | + && mkdir /usr/local/ffmpeg \  | 
 | 58 | + && ln -s /usr/bin/ffmpeg /usr/local/ffmpeg/ffmpeg  | 
 | 59 | + | 
 | 60 | + | 
 | 61 | +# python library  | 
 | 62 | +COPY rootfs/usr/local/lib/web/backend/requirements.txt /tmp/  | 
 | 63 | +RUN apt-get update \  | 
 | 64 | + && dpkg-query -W -f='${Package}\n' > /tmp/a.txt \  | 
 | 65 | + && apt-get install -y python-pip python-dev build-essential \  | 
 | 66 | +&& pip install setuptools wheel && pip install -r /tmp/requirements.txt \  | 
 | 67 | + && dpkg-query -W -f='${Package}\n' > /tmp/b.txt \  | 
 | 68 | + && apt-get remove -y `diff --changed-group-format='%>' --unchanged-group-format='' /tmp/a.txt /tmp/b.txt | xargs` \  | 
 | 69 | + && apt-get autoclean -y \  | 
 | 70 | + && apt-get autoremove -y \  | 
 | 71 | + && rm -rf /var/lib/apt/lists/* \  | 
 | 72 | + && rm -rf /var/cache/apt/* /tmp/a.txt /tmp/b.txt  | 
 | 73 | + | 
 | 74 | + | 
 | 75 | +################################################################################  | 
 | 76 | +# builder  | 
 | 77 | +################################################################################  | 
 | 78 | +FROM ubuntu:18.04 as builder  | 
 | 79 | + | 
 | 80 | + | 
 | 81 | + | 
 | 82 | +RUN apt-get update \  | 
 | 83 | + && apt-get install -y --no-install-recommends curl ca-certificates gnupg patch  | 
 | 84 | + | 
 | 85 | +# nodejs  | 
 | 86 | +RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \  | 
 | 87 | + && apt-get install -y nodejs  | 
 | 88 | + | 
 | 89 | +# yarn  | 
 | 90 | +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \  | 
 | 91 | + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \  | 
 | 92 | + && apt-get update \  | 
 | 93 | + && apt-get install -y yarn  | 
 | 94 | + | 
 | 95 | +# build frontend  | 
 | 96 | +COPY web /src/web  | 
 | 97 | +RUN cd /src/web \  | 
 | 98 | + && yarn \  | 
 | 99 | + && yarn build  | 
 | 100 | + | 
 | 101 | + | 
 | 102 | + | 
 | 103 | +################################################################################  | 
 | 104 | +# merge  | 
 | 105 | +################################################################################  | 
 | 106 | +FROM system  | 
 | 107 | +LABEL maintainer="fcwu.tw@gmail.com"  | 
 | 108 | + | 
 | 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 | + | 
 | 114 | +EXPOSE 80  | 
 | 115 | +WORKDIR /root  | 
 | 116 | +ENV HOME=/home/ubuntu \  | 
 | 117 | + SHELL=/bin/bash  | 
 | 118 | +HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health  | 
 | 119 | +ENTRYPOINT ["/startup.sh"]  | 
0 commit comments