forked from cs61/cs61-f24-psets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
119 lines (102 loc) · 2.91 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
FROM ubuntu:noble
# set environment variables for tzdata
ARG TZ=America/New_York
ENV TZ=${TZ}
# include manual pages and documentation
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update &&\
apt-get -y install unminimize &&\
yes | unminimize
# install GCC-related packages
RUN apt-get -y install\
binutils-doc\
cpp-doc\
gcc-doc\
g++\
g++-multilib\
gdb\
gdb-doc\
glibc-doc\
libblas-dev\
liblapack-dev\
liblapack-doc\
libstdc++-13-doc\
make\
make-doc
# install clang-related packages
RUN apt-get -y install\
clang\
clang-18-doc\
lldb
# install qemu for WeensyOS (sadly, this pulls in a lot of crap)
RUN apt-get -y install\
qemu-system-x86
# install programs used for system exploration
RUN apt-get -y install\
blktrace\
linux-tools-generic\
strace\
tcpdump
# install interactive programs (emacs, vim, nano, man, sudo, etc.)
RUN apt-get -y install\
bc\
curl\
dc\
emacs-nox\
git\
git-doc\
man\
micro\
nano\
psmisc\
sudo\
vim\
wget
# set up libraries
RUN apt-get -y install\
libreadline-dev\
locales\
wamerican
# install programs used for networking
RUN apt-get -y install\
dnsutils\
inetutils-ping\
iproute2\
net-tools\
netcat-openbsd\
telnet\
time\
traceroute
# set up default locale
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
# remove unneeded .deb files
RUN rm -r /var/lib/apt/lists/*
# set up passwordless sudo for user cs61-user
ARG UID=1001
RUN useradd -m -s /bin/bash -u "${UID}" cs61-user &&\
echo "cs61-user ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/cs61-init
# create binary reporting version of dockerfile
RUN (echo '#\!/bin/sh'; echo 'echo 19') > /usr/bin/cs61-docker-version; chmod ugo+rx,u+w,go-w /usr/bin/cs61-docker-version
# git build arguments
ARG USER=CS61\ User
ARG EMAIL=nobody@example.com
# configure your environment
USER cs61-user
RUN git config --global user.name "${USER}" &&\
git config --global user.email "${EMAIL}" &&\
git config --global safe.directory "*" &&\
(echo "(custom-set-variables"; echo " '(c-basic-offset 4)"; echo " '(indent-tabs-mode nil))") > ~/.emacs &&\
(echo "set expandtab"; echo "set shiftwidth=4"; echo "set softtabstop=4") > ~/.vimrc &&\
cat /dev/null > ~/.bash_profile &&\
echo "# 2022: avoid a Docker bug with user mapping by listing working directory" >> ~/.bash_profile &&\
echo "ls -al > /dev/null" >> ~/.bash_profile &&\
echo "for i in \`mount | grep /home/cs61-user | sed 's/^.*\\(\\/home[^ ]*\\).*/\\\\1/'\`; do ls -al \$i > /dev/null; done" >> ~/.bash_profile &&\
echo "# make ssh-auth.sock user-readable" >> ~/.bash_profile &&\
(echo "if test -e /run/host-services/ssh-auth.sock; then"; echo " sudo chown cs61-user:cs61-user /run/host-services/ssh-auth.sock"; echo "fi") >> ~/.bash_profile &&\
echo ". ~/.bashrc" >> ~/.bash_profile &&\
rm -f ~/.bash_logout &&\
echo "add-auto-load-safe-path ~" > ~/.gdbinit
WORKDIR /home/cs61-user
CMD ["/bin/bash", "-l"]
# Initial version of this Dockerfile by Todd Morrill, CS 61 DCE student