-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.kubernetes
199 lines (159 loc) · 5.4 KB
/
Dockerfile.kubernetes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# defaul TAG is dev
ARG TAG=dev
# Default release is 18.04
ARG BASE_IMAGE_RELEASE=18.04
# Default base image
ARG BASE_IMAGE=abcdesktopio/oc.software.18.04
# --- BEGIN node_modules_builder ---
FROM $BASE_IMAGE:$TAG as node_modules_builder
#
# Add dev package to node install
## You may also need development tools to build native addons:
## sudo apt-get install gcc g++ make
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# to make install wmctrljs nodejs components
# add build dev package
RUN apt-get update && apt-get install -y --no-install-recommends \
libx11-dev \
libxmu-dev \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
#Install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y --no-install-recommends \
yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY composer /composer
# add wait-port
RUN mkdir -p /composer/node/wait-port && cd /composer/node/wait-port && yarn add wait-port
# Add nodejs service
WORKDIR /composer/node/common-libraries
RUN yarn install
WORKDIR /composer/node/broadcast-service
RUN yarn install
WORKDIR /composer/node/ocrun
RUN yarn install
WORKDIR /composer/node/ocdownload
RUN yarn install
WORKDIR /composer/node/occall
RUN yarn install
WORKDIR /composer/node/spawner-service
RUN yarn install
WORKDIR /composer/node/xterm.js
RUN yarn install
COPY Makefile /
COPY mkversion.sh /
COPY .git /
WORKDIR /
RUN make version
# --- END node_modules_builder ---
# --- START Build image ---
FROM $BASE_IMAGE:$TAG
# add websockify as ws to tcp proxy
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \
python3-wheel \
python3-setuptools \
&& pip3 install websockify \
&& apt-get remove -y python3-pip python3-wheel python3-setuptools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
#Install yarn
# yarn is use for the test mode
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y --no-install-recommends \
yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# only for dev
RUN apt-get update && apt-get install -y --no-install-recommends \
vim \
file \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=node_modules_builder /composer /composer
# Next command use $BUSER context
ENV BUSER balloon
# RUN adduser --disabled-password --gecos '' $BUSER
# RUN id -u $BUSER &>/dev/null ||
RUN groupadd --gid 4096 $BUSER
RUN useradd --create-home --shell /bin/bash --uid 4096 -g $BUSER --groups sudo $BUSER
# create an ubuntu user
RUN echo "balloon:lmdpocpetit" | chpasswd $BUSER
# hack: be shure to own the home dir
RUN chown -R $BUSER:$BUSER /home/$BUSER
# remove symlink in /etc/X11
# openbox -> ../xdg/openbox
# xdg does not exist
RUN rm -rf /etc/X11/openbox
COPY etc /etc
RUN rm -rf /etc/supervisor/conf.d/pulseaudio.conf /etc/supervisor/conf.d/printer-service.conf /etc/supervisor/conf.d/file-service.conf /etc/supervisor/conf.d/cupsd.conf
RUN date > /etc/build.date
# Add here commands need to run as sudo user
# cupsd must be run as root
# changehomeowner
RUN echo "$BUSER ALL=(root) NOPASSWD: /composer/changehomeowner.sh" >> /etc/sudoers.d/changehomeowner
# create a fake ntlm_auth.desktop file
# just to hidden missing link dest
RUN touch /usr/bin/ntlm_auth.desktop
# LOG AND PID SECTION
RUN mkdir -p /var/log/desktop \
/var/run/desktop \
/composer/run
## DBUS SECTION
RUN mkdir -p /var/run/dbus
RUN touch /var/lib/dbus/machine-id
RUN chown -R $BUSER:$BUSER \
/var/run/dbus \
/var/lib/dbus \
/var/lib/dbus/machine-id
# DO NOT CHANGE
# COPY usr/share/dbus-1/session.conf /usr/share/dbus-1/session.conf
# COPY usr/share/dbus-1/system.conf /usr/share/dbus-1/system.conf
# change access rights
RUN chown -R $BUSER:$BUSER \
/etc/X11/openbox \
/var/log/desktop \
/var/run/desktop \
/composer/run \
/composer/mime \
/composer/icons \
/composer/.themes \
/composer/.gtkrc-2.0 \
/composer/.xsettings \
/composer/.gconf \
/composer/.Xressources \
/composer/.bashrc \
/composer/.cache
# Clean unecessary package
RUN rm -rf /tmp/*
# VOLUME /home/$BUSER
WORKDIR /home/$BUSER
USER $BUSER
CMD [ "/composer/docker-entrypoint.sh" ]
####################################################
# SERVICE # TCP PORT #
####################################################
# FILEMANAGER_BRIDGE_TCP_PORT 29780
# XTERM_TCP_PORT 29781
# PULSEAUDIO_HTTP_PORT 4714
# FILE_SERVICE_TCP_PORT 29783
# BROADCAST_SERVICE_TCP_PORT 29784
# RESERVED FOR CUPSD 29785
# SPAWNER_SERVICE_TCP_PORT 29786
# WS_TCP_BRIDGE_SERVICE_TCP_PORT 6081
# DBUS_SESSION_TCP_PORT 55556
# DBUS_SYSTEM_TCP_PORT 55557
####################################################
## RESERVED TCP PORT 29782 for pulseaudio
## RESERVED TCP PORT 29785 for cupsd
EXPOSE 4714 6081 29780 29781 29783 29784 29786 55556 55557