forked from kasmtech/workspaces-core-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile-gh-core
169 lines (145 loc) · 6 KB
/
dockerfile-gh-core
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
#### Build Stage ####
ARG BASE_IMAGE="ubuntu:20.04"
FROM $BASE_IMAGE AS base_layer
### Environment config
ARG BG_IMG=gh_desktop.png
ARG EXTRA_SH=noop.sh
ARG DISTRO=ubuntu
ARG LANG='en_US.UTF-8'
ARG LANGUAGE='en_US:en'
ARG LC_ALL='en_US.UTF-8'
ARG TZ='Etc/UTC'
ENV DEBIAN_FRONTEND=noninteractive \
DISTRO=$DISTRO \
HOME=/home/ghuser \
INST_SCRIPTS=/dockerstartup/install \
KASM_VNC_PATH=/usr/share/kasmvnc \
LANG=$LANG \
LANGUAGE=$LANGUAGE \
LC_ALL=$LC_ALL \
TZ=$TZ \
STARTUPDIR=/dockerstartup
### Create user and home directory for base images
RUN (groupadd -g 1000 ghuser \
&& useradd -M -u 1000 -g 1000 ghuser \
&& usermod -a -G ghuser ghuser) ; exit 0
WORKDIR $HOME
RUN mkdir -p $HOME/Desktop && \
mkdir -p $HOME/Downloads && \
mkdir -p $HOME/Workspace/AppData && \
mkdir -p $HOME/Workspace/Documents
### Setup package rules (i.e. apt-get upgrade -y)
COPY ./src/ubuntu/install/package_rules $INST_SCRIPTS/package_rules/
RUN bash $INST_SCRIPTS/package_rules/package_rules.sh && rm -rf $INST_SCRIPTS/package_rules/
### Install common tools
COPY ./src/ubuntu/install/tools $INST_SCRIPTS/tools/
RUN bash $INST_SCRIPTS/tools/install_tools.sh && rm -rf $INST_SCRIPTS/tools/
### Copy over the maximization script to our startup dir for use by app images.
COPY ./src/ubuntu/install/maximize_script $STARTUPDIR/
COPY ./src/gh/fullscreen_window.sh $STARTUPDIR/
### Install custom fonts
COPY ./src/ubuntu/install/fonts $INST_SCRIPTS/fonts/
RUN bash $INST_SCRIPTS/fonts/install_custom_fonts.sh && rm -rf $INST_SCRIPTS/fonts/
### Install xfce UI
COPY ./src/ubuntu/install/xfce $INST_SCRIPTS/xfce/
RUN bash $INST_SCRIPTS/xfce/install_xfce_ui.sh && rm -rf $INST_SCRIPTS/xfce/
ADD ./src/gh/.config/ $HOME/.config/
RUN mkdir -p /usr/share/extra/backgrounds/
RUN mkdir -p /usr/share/extra/icons/
ADD /src/common/resources/images/$BG_IMG /usr/share/backgrounds/bg_default.png
ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_ubuntu.png
ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_default.png
ADD /src/common/resources/images/egress_info.svg /usr/share/extra/icons/egress_info.svg
ADD /src/common/resources/images/egress_error.svg /usr/share/extra/icons/egress_error.svg
ADD /src/common/resources/images/egress_offline.svg /usr/share/extra/icons/egress_offline.svg
COPY src/kasmvncserver.deb $INST_SCRIPTS/
RUN apt-get update && \
apt-get install -y gettext ssl-cert libxfont2 && \
apt-get install -y $INST_SCRIPTS/kasmvncserver.deb && \
rm -f $INST_SCRIPTS//kasmvncserver.deb
COPY ./src/common/install/kasm_vnc/kasmvnc.yaml /etc/kasmvnc/
### Install Printer and Network packages
RUN apt-get install -y cups cups-client cups-pdf dbus iproute2 iptables
### Install custom cursors
COPY ./src/ubuntu/install/cursors $INST_SCRIPTS/cursors/
RUN bash $INST_SCRIPTS/cursors/install_cursors.sh && rm -rf $INST_SCRIPTS/cursors/
### configure startup
ADD ./src/common/startup_scripts $INST_SCRIPTS
# *GH* override vnc_startup.sh with a simpler one
COPY ./src/gh/vnc_startup.sh $STARTUPDIR
RUN bash $INST_SCRIPTS/set_user_permission.sh $STARTUPDIR $HOME && \
echo 'export PS1="$USERNAME:\w\$ "' >> $HOME/.bashrc
### VirtualGL
COPY ./src/ubuntu/install/virtualgl $INST_SCRIPTS/virtualgl/
RUN bash $INST_SCRIPTS/virtualgl/install_virtualgl.sh && rm -rf $INST_SCRIPTS/virtualgl/
### Sysbox support
#COPY ./src/ubuntu/install/sysbox $INST_SCRIPTS/sysbox/
#RUN bash $INST_SCRIPTS/sysbox/install_systemd.sh && rm -rf $INST_SCRIPTS/sysbox/
### Custom Folder Emblems
COPY ./src/ubuntu/install/emblems $INST_SCRIPTS/emblems/
RUN bash $INST_SCRIPTS/emblems/install_vs_emblem.sh && rm -rf $INST_SCRIPTS/emblems/
RUN chown -R 1000:0 $HOME
### FIX PERMISSIONS ## Objective is to change the owner of non-home paths to root, remove write permissions, and set execute where required
# these files are created on container first exec, by the default user, so we have to create them since default will not have write perm
RUN touch $STARTUPDIR/wm.log \
&& touch $STARTUPDIR/window_manager_startup.log \
&& touch $STARTUPDIR/vnc_startup.log \
&& touch $STARTUPDIR/no_vnc_startup.log \
&& chown -R root:root $STARTUPDIR \
&& find $STARTUPDIR -type d -exec chmod 755 {} \; \
&& find $STARTUPDIR -type f -exec chmod 644 {} \; \
&& find $STARTUPDIR -type f -iname "*.sh" -exec chmod 755 {} \; \
&& find $STARTUPDIR -type f -iname "*.py" -exec chmod 755 {} \; \
&& find $STARTUPDIR -type f -iname "*.rb" -exec chmod 755 {} \; \
&& find $STARTUPDIR -type f -iname "*.pl" -exec chmod 755 {} \; \
&& find $STARTUPDIR -type f -iname "*.log" -exec chmod 666 {} \; \
&& rm -rf $STARTUPDIR/install \
&& chown -R root:root /usr/local/bin \
&& rm -Rf /home/kasm-default-profile/.launchpadlib
### Cleanup job
COPY ./src/ubuntu/install/cleanup $INST_SCRIPTS/cleanup/
RUN bash $INST_SCRIPTS/cleanup/cleanup.sh && rm -rf $INST_SCRIPTS/cleanup/
#### Runtime Stage ####
FROM scratch
COPY --from=base_layer / /
### Labels
LABEL "org.opencontainers.image.authors"='Golden Helix "[email protected]"'
### Environment config
ARG DISTRO=ubuntu
ARG EXTRA_SH=noop.sh
ARG LANG='en_US.UTF-8'
ARG LANGUAGE='en_US:en'
ARG LC_ALL='en_US.UTF-8'
ARG START_XFCE4=1
ARG TZ='Etc/UTC'
ENV DEBIAN_FRONTEND=noninteractive \
DISPLAY=:1 \
DISTRO=$DISTRO \
GOMP_SPINCOUNT=0 \
HOME=/home/ghuser \
USERNAME=ghuser \
INST_SCRIPTS=/dockerstartup/install \
KASM_VNC_PATH=/usr/share/kasmvnc \
LANG=$LANG \
LANGUAGE=$LANGUAGE \
LC_ALL=$LC_ALL \
MAX_FRAME_RATE=24 \
NO_VNC_PORT=6901 \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
STARTUPDIR=/dockerstartup \
START_XFCE4=$START_XFCE4 \
SINGLE_APPLICATION=0 \
TERM=xterm \
VNC_COL_DEPTH=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7 -DLP_ClipDelay=0" \
VNC_USER=ghuser \
VNC_PW=vncpassword \
VNC_RESOLUTION=1280x720 \
TZ=$TZ
### Ports and user
EXPOSE $NO_VNC_PORT
WORKDIR $HOME
USER 1000
ENTRYPOINT ["/dockerstartup/vnc_startup.sh"]
CMD ["--wait"]