forked from mit-pdos/xv6-public
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
78 lines (66 loc) · 2.01 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
FROM ubuntu:22.04 as base
ENV DEBIAN_FRONTEND=noninteractive
# Update package lists and install dependencies
RUN apt-get update && \
apt-get install -y \
g++ \
make \
libpcre3-dev \
curl \
tar \
python3 \
vim \
git \
cmake \
sudo \
python3.10-venv \
qemu-kvm \
libvirt-daemon-system \
libvirt-clients \
bridge-utils \
virt-manager \
expect \
jq
# Download and extract Cppcheck
WORKDIR /opt
RUN curl -LO https://github.com/danmar/cppcheck/archive/2.11.tar.gz && \
tar -xf 2.11.tar.gz
# Build and install Cppcheck
WORKDIR /opt/cppcheck-2.11
RUN make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes \
CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" \
install
# Clone the llvm-project repository
WORKDIR /opt/llvm-project
RUN git clone --depth 1 --branch llvmorg-16.0.6 \
https://github.com/llvm/llvm-project.git clang-format
# Build and install clang-format
WORKDIR /opt/llvm-project/clang-format/build
RUN cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="clang" \
-DCMAKE_BUILD_TYPE=Release ../llvm && \
make clang-format && \
cp bin/clang-format /usr/local/bin
# Install packages for host unit tests
RUN apt-get install -y gcc-multilib
# Create a non-root user with the same username,uid,gid
# as the user running the container
ARG USERNAME
ARG GRPNAME
ARG UID
ARG GID
RUN groupadd -g $GID $GRPNAME
RUN useradd -u $UID -g $GID -s /bin/bash $USERNAME
# Install cpplint+bashate for the user in a venv, and activate it.
ENV XV6_VENV=/xv6-venv
RUN python3 -m venv $XV6_VENV
ENV PATH=$XV6_VENV/bin:$PATH
RUN pip install cpplint~=2.0.0 bashate==2.1.1 && \
chmod -R 777 $XV6_VENV
# Change user
USER $USERNAME
# Set the working directory inside the container
WORKDIR /home/$USERNAME/xv6
# Set the default command to start the container
CMD ["/bin/bash"]
# Set the entrypoint command
# ENTRYPOINT ["/home/$USERNAME/xv6/run-ci.sh"]