Skip to content

Commit f2b453b

Browse files
committed
feat: add gnome Dockerfile (testing)
1 parent 6421bc5 commit f2b453b

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

ubuntu/Dockerfile.18.04.gnome.amd64

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
FROM ubuntu:18.04 as system
2+
3+
RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
4+
5+
# built-in packages
6+
ENV DEBIAN_FRONTEND noninteractive
7+
RUN apt update \
8+
&& apt install -y --no-install-recommends software-properties-common curl apache2-utils \
9+
&& apt update \
10+
&& apt install -y --no-install-recommends --allow-unauthenticated \
11+
supervisor nginx sudo net-tools zenity xz-utils \
12+
dbus-x11 x11-utils alsa-utils \
13+
mesa-utils libgl1-mesa-dri \
14+
&& apt autoclean -y \
15+
&& apt autoremove -y \
16+
&& rm -rf /var/lib/apt/lists/*
17+
# install debs error if combine together
18+
RUN apt update \
19+
&& apt install -y --no-install-recommends --allow-unauthenticated \
20+
xvfb x11vnc \
21+
vim-tiny firefox xfce4-terminal ttf-ubuntu-font-family \
22+
&& apt autoclean -y \
23+
&& apt autoremove -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
RUN apt update \
27+
&& apt install -y --no-install-recommends --allow-unauthenticated \
28+
ubuntu-desktop \
29+
gnome-panel \
30+
gnome-settings-daemon \
31+
metacity \
32+
nautilus \
33+
gnome-terminal \
34+
&& apt autoclean -y \
35+
&& apt autoremove -y \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
# python library (for backend)
39+
COPY rootfs/usr/local/lib/web/backend/requirements.txt /tmp/
40+
RUN apt-get update \
41+
&& dpkg-query -W -f='${Package}\n' > /tmp/a.txt \
42+
&& apt-get install -y python-pip python-dev build-essential \
43+
&& pip install setuptools wheel && pip install -r /tmp/requirements.txt \
44+
&& dpkg-query -W -f='${Package}\n' > /tmp/b.txt \
45+
&& apt-get remove -y `diff --changed-group-format='%>' --unchanged-group-format='' /tmp/a.txt /tmp/b.txt | xargs` \
46+
&& apt-get autoclean -y \
47+
&& apt-get autoremove -y \
48+
&& rm -rf /var/lib/apt/lists/* \
49+
&& rm -rf /var/cache/apt/* /tmp/a.txt /tmp/b.txt
50+
51+
######## Frontend builder
52+
FROM ubuntu:18.04 as builder
53+
54+
RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
55+
56+
57+
RUN apt-get update \
58+
&& apt-get install -y --no-install-recommends curl ca-certificates gnupg patch
59+
60+
# nodejs
61+
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
62+
&& apt-get install -y nodejs
63+
64+
# yarn
65+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
66+
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
67+
&& apt-get update \
68+
&& apt-get install -y yarn
69+
70+
# build frontend
71+
COPY web /src/web
72+
RUN cd /src/web \
73+
&& yarn \
74+
&& yarn build
75+
76+
####### Build final image with frontend
77+
FROM system
78+
LABEL maintainer="[email protected]"
79+
80+
COPY --from=builder /src/web/dist/ /usr/local/lib/web/frontend/
81+
COPY rootfs /
82+
RUN cp /etc/supervisor/conf.d/supervisord.xfce /etc/supervisor/conf.d/supervisord.conf
83+
RUN ln -sf /usr/local/lib/web/frontend/static/websockify /usr/local/lib/web/frontend/static/novnc/utils/websockify && \
84+
chmod +x /usr/local/lib/web/frontend/static/websockify/run
85+
86+
RUN ln -sf /usr/local/lib/web/frontend/static/vnc.html /usr/local/lib/web/frontend/static/index.html
87+
RUN ln -sf /usr/local/lib/web/frontend/static/novnc/vnc.html /usr/local/lib/web/frontend/static/novnc/index.html
88+
89+
EXPOSE 80
90+
91+
ENV HOME=/home/work \
92+
SHELL=/bin/bash
93+
HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health
94+
95+
# Backend.AI specifics
96+
LABEL ai.backend.kernelspec="1" \
97+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
98+
ai.backend.features="batch query uid-match user-input" \
99+
ai.backend.resource.min.cpu="1" \
100+
ai.backend.resource.min.mem="1g" \
101+
ai.backend.resource.preferred.shmem="512m" \
102+
ai.backend.base-distro="ubuntu18.04" \
103+
ai.backend.runtime-type="app" \
104+
ai.backend.service-ports="xfce:http:80,vnc:http:5900"
105+
106+
COPY ./service-defs /etc/backend.ai/service-defs
107+
COPY policy.yml /etc/backend.ai/jail/policy.yml
108+
COPY bootstrap_xfce.sh /opt/container/bootstrap.sh
109+
WORKDIR /home/work

0 commit comments

Comments
 (0)