-
Notifications
You must be signed in to change notification settings - Fork 354
/
Dockerfile
178 lines (146 loc) · 5.28 KB
/
Dockerfile
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
# Build stage
ARG TAG
FROM cs50/cli:${TAG} AS builder
ARG DEBIAN_FRONTEND=noninteractive
# Unset user
USER root
# Install glibc sources for debugger
# https://github.com/Microsoft/vscode-cpptools/issues/1123#issuecomment-335867997
RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted" > /etc/apt/sources.list.d/_.list && \
apt update && \
apt install --no-install-recommends --no-install-suggests --yes \
dpkg-dev && \
cd /tmp && \
apt source glibc && \
rm --force --recursive *.dsc *.tar.* && \
mkdir --parents /build/glibc-sMfBJT && \
tar --create --gzip --file /build/glibc-sMfBJT/glibc.tar.gz glibc*
# Install BFG
RUN wget https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar -P /opt/share
# Install Lua 5.x
# https://www.lua.org/download.html
RUN cd /tmp && \
curl --remote-name https://www.lua.org/ftp/lua-5.4.7.tar.gz && \
tar xzf lua-5.4.7.tar.gz && \
rm --force lua-5.4.7.tar.gz && \
cd lua-5.4.7 && \
make all install && \
cd .. && \
rm --force --recursive /tmp/lua-5.4.7
# Install noVNC (VNC client)
RUN cd /tmp && \
curl --location --remote-name https://github.com/novnc/noVNC/archive/refs/tags/v1.5.0.zip && \
unzip v1.5.0.zip && \
rm --force v1.5.0.zip && \
cd noVNC-1.5.0/utils && \
curl --location --remote-name https://github.com/novnc/websockify/archive/refs/heads/master.tar.gz && \
tar xzf master.tar.gz && \
mv websockify-master websockify && \
rm --force master.tar.gz && \
cd ../.. && \
mv noVNC-1.5.0 /opt/noVNC
# Install VS Code extensions
RUN npm install --global @vscode/vsce yarn && \
mkdir --parents /opt/cs50/extensions && \
cd /tmp && \
git clone https://github.com/cs50/explain50.vsix.git && \
cd explain50.vsix && \
npm install && \
vsce package && \
mv explain50-1.0.0.vsix /opt/cs50/extensions && \
cd /tmp && \
rm --force --recursive explain50.vsix && \
git clone https://github.com/cs50/cs50.vsix.git && \
cd cs50.vsix && \
npm install && \
vsce package && \
mv cs50-0.0.1.vsix /opt/cs50/extensions && \
mv python-clients/cs50vsix-client /opt/cs50/extensions && \
cd /tmp && \
rm --force --recursive cs50.vsix && \
git clone https://github.com/cs50/ddb50.vsix.git && \
cd ddb50.vsix && \
npm install && \
vsce package && \
mv ddb50-2.0.0.vsix /opt/cs50/extensions && \
cd /tmp && \
rm --force --recursive ddb50.vsix && \
git clone https://github.com/cs50/phpliteadmin.vsix.git && \
cd phpliteadmin.vsix && \
npm install && \
vsce package && \
mv phpliteadmin-0.0.1.vsix /opt/cs50/extensions && \
cd /tmp && \
rm --force --recursive phpliteadmin.vsix && \
git clone https://github.com/cs50/style50.vsix.git && \
cd style50.vsix && \
npm install && \
vsce package && \
mv style50-0.0.1.vsix /opt/cs50/extensions && \
cd /tmp && \
rm --force --recursive style50.vsix && \
git clone https://github.com/cs50/design50.vsix.git && \
cd design50.vsix && \
npm install && \
vsce package && \
mv design50-1.0.0.vsix /opt/cs50/extensions && \
cd /tmp && \
rm --force --recursive design50.vsix && \
npm uninstall --global vsce yarn
# Final stage
FROM cs50/cli:${TAG}
# Unset user
USER root
ARG DEBIAN_FRONTEND=noninteractive
# Copy files from builder
COPY --from=builder /build /build
COPY --from=builder /opt /opt
COPY --from=builder /usr/local /usr/local
RUN pip3 install --no-cache-dir /opt/cs50/extensions/cs50vsix-client/ && \
rm --force --recursive /opt/cs50/extensions/cs50vsix-client
# Set virtual display
ENV DISPLAY=":0"
# Install Ubuntu packages
# Install acl for temporarily removing ACLs via opt/cs50/bin/postCreateCommand
# https://github.community/t/bug-umask-does-not-seem-to-be-respected/129638/9
RUN apt update && \
apt install --no-install-recommends --no-install-suggests --yes \
acl \
dwarfdump \
jq \
openbox \
mysql-client \
php-cli \
php-mbstring \
php-sqlite3 \
x11vnc \
xvfb && \
apt clean
# Install GitHub CLI
RUN (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
# Install Python packages
RUN pip3 install --no-cache-dir \
black \
djhtml \
inflect==7.0.0 \
matplotlib \
pillow==10.4.0 \
"pydantic<2" \
pytz \
setuptools
# Copy files to image
COPY ./etc /etc
COPY ./opt /opt
RUN chmod a+rx /opt/cs50/bin/* && \
chmod a+rx /opt/cs50/phpliteadmin/bin/phpliteadmin && \
ln --symbolic /opt/cs50/phpliteadmin/bin/phpliteadmin /opt/cs50/bin/phpliteadmin
# Enforce login shell
RUN echo "\nshopt -q login_shell || exec bash --login -i" >> /etc/bash.bashrc
# Set user
USER ubuntu