|
| 1 | +# Use Ubuntu 24.04 as the base image |
| 2 | +FROM ghcr.io/openxiangshan/xs-env:ubuntu-24.04 |
| 3 | + |
| 4 | +# Set non-interactive installation |
| 5 | +ENV DEBIAN_FRONTEND=noninteractive |
| 6 | + |
| 7 | +# Set the locale |
| 8 | +ENV LANG=C.UTF-8 |
| 9 | +ENV LANGUAGE=C.UTF-8 |
| 10 | +ENV LC_ALL=C.UTF-8 |
| 11 | +# Use https for apt repositories |
| 12 | +RUN apt update && \ |
| 13 | + apt install -y --no-install-recommends apt-transport-https ca-certificates && \ |
| 14 | + apt-get clean && \ |
| 15 | + rm -rf /var/lib/apt/lists/* |
| 16 | +RUN sed -i 's|http|https|g' /etc/apt/sources.list |
| 17 | + |
| 18 | +# Set the timezone to France |
| 19 | +ENV TZ=Asia/Shanghai |
| 20 | +RUN apt-get update && \ |
| 21 | + apt-get install -y --no-install-recommends tzdata && \ |
| 22 | + ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \ |
| 23 | + dpkg-reconfigure --frontend noninteractive tzdata && \ |
| 24 | + apt-get clean && \ |
| 25 | + rm -rf /var/lib/apt/lists/* |
| 26 | + |
| 27 | +# Install dependencies |
| 28 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 29 | + ca-certificates \ |
| 30 | + build-essential \ |
| 31 | + git \ |
| 32 | + sudo \ |
| 33 | + wget \ |
| 34 | + curl \ |
| 35 | + vim \ |
| 36 | + software-properties-common \ |
| 37 | + python3 \ |
| 38 | + python3-pip \ |
| 39 | + python3-dev \ |
| 40 | + libpcre3-dev \ |
| 41 | + pkg-config \ |
| 42 | + libfl-dev \ |
| 43 | + bison \ |
| 44 | + flex \ |
| 45 | + gperf \ |
| 46 | + clang \ |
| 47 | + g++ \ |
| 48 | + zlib1g-dev \ |
| 49 | + openssh-server \ |
| 50 | + gnupg \ |
| 51 | + autoconf \ |
| 52 | + automake \ |
| 53 | + libtool \ |
| 54 | + openjdk-17-jdk \ |
| 55 | + libpcre2-dev \ |
| 56 | + help2man && \ |
| 57 | + apt-get clean && \ |
| 58 | + rm -rf /var/lib/apt/lists/* |
| 59 | + |
| 60 | +# Install SWIG (4.2.1)d |
| 61 | +RUN git clone https://github.com/swig/swig.git -b v4.2.1 --depth=1 /tmp/swig && \ |
| 62 | + cd /tmp/swig && \ |
| 63 | + ./autogen.sh && \ |
| 64 | + ./configure --prefix=/usr/local && \ |
| 65 | + make -j$(nproc) && \ |
| 66 | + make install && \ |
| 67 | + rm -rf /tmp/swig |
| 68 | + |
| 69 | +# Set up Kitware repository and install the latest CMake |
| 70 | +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \ |
| 71 | + gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \ |
| 72 | + echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | \ |
| 73 | + tee /etc/apt/sources.list.d/kitware.list >/dev/null && \ |
| 74 | + apt-get update && \ |
| 75 | + apt-get install -y --no-install-recommends cmake && \ |
| 76 | + apt-get clean && \ |
| 77 | + rm -rf /var/lib/apt/lists/* |
| 78 | + |
| 79 | +# Verify Dependency installations |
| 80 | +RUN swig -version && \ |
| 81 | + cmake --version && \ |
| 82 | + verilator --version && \ |
| 83 | + java --version && \ |
| 84 | + python3 --version |
| 85 | + |
| 86 | +# Install Picker |
| 87 | +ENV BUILD_XSPCOMM_SWIG=python,java |
| 88 | +RUN mkdir /workspace && \ |
| 89 | + cd /workspace && \ |
| 90 | + git clone https://github.com/XS-MLVP/picker.git --depth=1 && \ |
| 91 | + wget https://github.com/chipsalliance/verible/releases/download/v0.0-3979-g786edf03/verible-v0.0-3979-g786edf03-linux-static-x86_64.tar.gz && \ |
| 92 | + tar -xzf verible-v0.0-3979-g786edf03-linux-static-x86_64.tar.gz -C /usr/local/ --strip-components=1 && \ |
| 93 | + rm verible-v0.0-3979-g786edf03-linux-static-x86_64.tar.gz && \ |
| 94 | + cd picker && make init && \ |
| 95 | + make -j$(nproc) && \ |
| 96 | + make install && \ |
| 97 | + make clean && \ |
| 98 | + chmod 755 /usr/local/bin -R |
| 99 | + |
| 100 | +# Get XS-Pdb |
| 101 | +RUN cd /workspace && \ |
| 102 | + git clone https://github.com/OpenXiangShan/XSPdb.git --depth=1 && \ |
| 103 | + cd XSPdb |
| 104 | + |
| 105 | +# set user and password |
| 106 | +RUN useradd -m -s /bin/bash user && \ |
| 107 | + echo "user:user" | chpasswd && \ |
| 108 | + adduser user sudo && \ |
| 109 | + echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ |
| 110 | + chown user:user -R /workspace && \ |
| 111 | + chmod 755 /workspace |
| 112 | + |
| 113 | +# Switch to the new user |
| 114 | +USER user |
| 115 | +# Set the default shell to bash |
| 116 | +SHELL ["/bin/bash", "-c"] |
| 117 | +# Set working directory |
| 118 | +WORKDIR /workspace |
0 commit comments