forked from cs50/codespace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
116 lines (88 loc) · 3.36 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
FROM cs50/cli:amd64
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/ focal main restricted" > /etc/apt/sources.list.d/_.list && \
apt update && \
cd /tmp && \
apt source glibc && \
rm --force /etc/apt/sources.list.d/_.list && \
apt update && \
mkdir --parents /build/glibc-sMfBJT && \
mv glibc* /build/glibc-sMfBJT && \
cd /build/glibc-sMfBJT \
rm --force --recursive *.tar.xz \
rm --force --recursive *.dsc
# Install window manager, X server, x11vnc (VNC server), noVNC (VNC client)
ENV DISPLAY=":0"
RUN apt install openbox xvfb x11vnc -y
RUN wget https://github.com/novnc/noVNC/archive/refs/tags/v1.3.0.zip -P/tmp && \
unzip /tmp/v1.3.0.zip -d /tmp && \
mv /tmp/noVNC-1.3.0 /opt/noVNC && \
rm -rf /tmp/noVNC-1.3.0 && \
chown -R ubuntu:ubuntu /opt/noVNC
# Install Ubuntu packages
RUN apt update && \
apt install --no-install-recommends --yes \
dwarfdump \
jq \
manpages-dev \
pgloader \
php-cli \
php-mbstring \
php-sqlite3
# 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 acl
# Install Python packages
RUN pip3 install \
matplotlib \
pandas \
Pillow \
scipy \
scikit-learn
# Install BFG
RUN wget https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar -P /opt/share && \
chown -R ubuntu:ubuntu /opt/share
# Enforce login shell
RUN echo "shopt -q login_shell || bash --login" >> /home/ubuntu/.bashrc && \
chown -R ubuntu:ubuntu /home/ubuntu/.bashrc
# Invalidate caching for the remaining instructions
ARG VCS_REF
# Install VS Code extensions
RUN npm install -g vsce yarn && \
mkdir --parents /opt/cs50/extensions && \
cd /tmp && \
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 && \
pip3 install python-clients/cs50vsix-client/ && \
cd /tmp && \
rm --force --recursive cs50.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 && \
npm uninstall -g vsce yarn
# Copy files to image
COPY ./etc /etc
COPY ./opt /opt
RUN chmod a+rx /opt/cs50/bin/*
RUN chmod a+rx /opt/cs50/phpliteadmin/bin/phpliteadmin
RUN ln --symbolic /opt/cs50/phpliteadmin/bin/phpliteadmin /opt/cs50/bin/phpliteadmin
# Temporary workaround for https://github.com/cs50/code.cs50.io/issues/19
RUN echo "if [ -z \"\$_PROFILE_D\" ] ; then for i in /etc/profile.d/*.sh; do if ["$i" == "/etc/profile.d/debuginfod*"] ; then continue; fi; . \"\$i\"; done; export _PROFILE_D=1; fi"
# Temporary fix for https://github.com/microsoft/vscode-cpptools/issues/103#issuecomment-1151217772
RUN wget https://launchpad.net/ubuntu/+source/gdb/12.1-0ubuntu1/+build/23606376/+files/gdb_12.1-0ubuntu1_amd64.deb -P/tmp && \
apt install /tmp/gdb_12.1-0ubuntu1_amd64.deb && \
rm -rf /tmp/gdb_12.1-0ubuntu1_amd64.deb
# Set user
USER ubuntu