@@ -2,14 +2,23 @@ FROM debian:bullseye
2
2
3
3
LABEL maintainer=
"[email protected] "
4
4
5
+ # Default (run-time) environment variables
6
+ # Used during initial setup
7
+ ENV USERNAME=user
8
+ ENV USER_ID=1000
9
+ ENV ALLOW_APT=yes
10
+ ENV ENTER_PASS=no
11
+ ENV ALLOW_SUDO=yes
12
+
13
+ # Build arguments, _only_ used during Docker build
5
14
ARG DEBIAN_FRONTEND=noninteractive
6
15
ARG APT_PROXY
7
16
8
17
WORKDIR /app
9
18
10
19
# Enable APT proxy (if APT_PROXY is set)
11
20
COPY ./configs/apt.conf ./
12
- COPY ./apt_proxy.sh ./
21
+ COPY ./scripts/ apt_proxy.sh ./
13
22
RUN ./apt_proxy.sh
14
23
15
24
# # First install basic required packages
@@ -28,20 +37,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
28
37
# # Add additional repositories/components (software-properties-common is required to be installed)
29
38
# Add contrib and non-free distro components (deb822-style format)
30
39
RUN apt-add-repository -y contrib && apt-add-repository -y non-free
31
- # Add Debian backports repo for XFCE thunar-font-manager
40
+ # Add Debian backports repo for XFCE thunar-font-manager
32
41
RUN add-apt-repository -y "deb http://deb.debian.org/debian bullseye-backports main contrib non-free"
33
42
34
43
# Retrieve third party GPG keys from keyserver
35
44
RUN gpg --keyserver keyserver.ubuntu.com --recv-keys 302F0738F465C1535761F965A6616109451BBBF2 972FD88FA0BAFB578D0476DFE1F958385BFE2B6E
36
45
37
46
# Add Linux Mint GPG keyring file (for the Mint-Y-Dark theme)
38
- RUN gpg --export 302F0738F465C1535761F965A6616109451BBBF2 | tee /etc/apt/trusted.gpg.d/linuxmint-archive-keyring.gpg > /dev/null
47
+ RUN gpg --export 302F0738F465C1535761F965A6616109451BBBF2 | tee /etc/apt/trusted.gpg.d/linuxmint-archive-keyring.gpg >/dev/null
39
48
40
49
# Add Linux Mint Debbie repo source file
41
50
COPY ./configs/linuxmint-debbie.list /etc/apt/sources.list.d/linuxmint-debbie.list
42
51
43
52
# Add X2Go GPG keyring file
44
- RUN gpg --export 972FD88FA0BAFB578D0476DFE1F958385BFE2B6E | tee /etc/apt/trusted.gpg.d/x2go-archive-keyring.gpg > /dev/null
53
+ RUN gpg --export 972FD88FA0BAFB578D0476DFE1F958385BFE2B6E | tee /etc/apt/trusted.gpg.d/x2go-archive-keyring.gpg >/dev/null
45
54
46
55
# Add X2Go repo source file
47
56
COPY ./configs/x2go.list /etc/apt/sources.list.d/x2go.list
@@ -85,10 +94,10 @@ RUN apt-get install -y --no-install-recommends fonts-ubuntu breeze-gtk-theme min
85
94
# Add LibreOffice
86
95
RUN apt install -y libreoffice-base libreoffice-base-core libreoffice-common libreoffice-core libreoffice-base-drivers \
87
96
libreoffice-nlpsolver libreoffice-script-provider-bsh libreoffice-script-provider-js libreoffice-script-provider-python libreoffice-style-colibre \
88
- libreoffice-writer libreoffice-calc libreoffice-impress libreoffice-draw libreoffice-math
97
+ libreoffice-writer libreoffice-calc libreoffice-impress libreoffice-draw libreoffice-math
89
98
90
99
# # Install XFCE4
91
- # Install XFCE4, including XFCE panels, terminal, screenshooter, task manager, notify daemon, dbus, locker and plugins.
100
+ # Install XFCE4, including XFCE panels, terminal, screenshooter, task manager, notify daemon, dbus, locker and plugins.
92
101
# ! But we do NOT install xfce4-goodies; since this will install xfburn (not needed) and xfce4-statusnotifier-plugin (deprecated) !
93
102
RUN apt-get upgrade -y && apt-get install -y --no-install-recommends \
94
103
xfwm4 xfce4-session default-dbus-session-bus xfdesktop4 light-locker \
@@ -110,12 +119,11 @@ RUN apt-get install -y --no-install-recommends \
110
119
111
120
# Update locales, generate new SSH host keys and clean-up (keep manpages)
112
121
RUN update-locale
113
- RUN rm -rf /etc/ssh/ssh_host_* \
114
- && ssh-keygen -A
122
+ RUN rm -rf /etc/ssh/ssh_host_* && ssh-keygen -A
115
123
RUN apt-get clean -y && rm -rf /usr/share/doc/* /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apk/*
116
124
117
125
# Update timezone to The Netherlands
118
- RUN echo 'Europe/Amsterdam' > /etc/timezone
126
+ RUN echo 'Europe/Amsterdam' >/etc/timezone
119
127
RUN unlink /etc/localtime && ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
120
128
121
129
# Start default XFCE4 panels (don't ask for it)
@@ -128,12 +136,25 @@ COPY ./configs/xfce4-settings.desktop /etc/xdg/autostart/
128
136
RUN sed -i "s/Hidden=.*/Hidden=false/" /etc/xdg/autostart/xfce4-clipman-plugin-autostart.desktop
129
137
# Remove unnecessary existing start-up apps
130
138
RUN rm -rf /etc/xdg/autostart/light-locker.desktop /etc/xdg/autostart/xscreensaver.desktop
131
- COPY ./setup.sh ./
139
+
140
+ # Disable root shell
141
+ RUN usermod -s /usr/sbin/nologin root
142
+
143
+ # Create worker user (instead of root user)
144
+ RUN useradd -G sudo -ms /bin/bash -u 1001 worker
145
+ RUN echo "Defaults!/app/setup.sh setenv" >>/etc/sudoers
146
+ # Limit the execute of the following commands of the worker user
147
+ RUN echo "worker ALL=(root) NOPASSWD:/usr/sbin/service ssh start, /usr/sbin/service dbus start, /usr/sbin/service rsyslog start, /app/setup.sh" >>/etc/sudoers
148
+ # Copy worker scripts
149
+ COPY ./scripts/setup.sh ./
132
150
COPY ./configs/terminalrc ./
133
151
COPY ./configs/whiskermenu-1.rc ./
134
- COPY ./xfce_settings.sh ./
135
- COPY ./run.sh ./
152
+ COPY ./scripts/xfce_settings.sh ./
153
+ COPY ./scripts/run.sh ./
154
+
155
+ # Run as worker
156
+ USER worker
136
157
137
158
EXPOSE 22
138
159
139
- CMD ./run.sh
160
+ CMD [ "/bin/bash" , " ./run.sh" ]
0 commit comments