Rust Web Browser Build

It is hard to decide which project is important for a software engineer. I feel I need a solid and fundamental projects for me that could last really really long for demonstrating my skill in software engineering industry. Besides the quite low level operating system and compiler, which takes huge amount of time studying and prepare, I prefer to work on the web browser which I can learn and contribute. The project I found is servo, which needs some additional file for building image and run in docker container with VS code.

For BUILD, RUN and DEBUG purpose, I created a dockerfile and docker image that properly build the project using mach. First write the Dockerfile with assistance from the offcial servo book.

# Use Ubuntu 22.04 as the base image for compatibility with Servo's dependencies
FROM ubuntu:22.04

# Set environment variables to avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install system dependencies required for Servo
RUN apt-get update && apt-get install -y \
    build-essential \
    ccache \
    clang \
    cmake \
    curl \
    g++ \
    git \
    gperf \
    libdbus-1-dev \
    libfreetype6-dev \
    libgl1-mesa-dri \
    libgles2-mesa-dev \
    libglib2.0-dev \
    gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-bad \
    libgstreamer-plugins-bad1.0-dev \
    gstreamer1.0-plugins-ugly \
    gstreamer1.0-plugins-base \
    libgstreamer-plugins-base1.0-dev \
    gstreamer1.0-libav \
    libgstrtspserver-1.0-dev \
    gstreamer1.0-tools \
    libges-1.0-dev \
    libharfbuzz-dev \
    liblzma-dev \
    libudev-dev \
    libunwind-dev \
    libvulkan1 \
    libx11-dev \
    libxcb-render0-dev \
    libxcb-shape0-dev \
    libxcb-xfixes0-dev \
    libxmu-dev \
    libxmu6 \
    libegl1-mesa-dev \
    llvm-dev \
    m4 \
    xorg-dev \
    libxkbcommon0 \
    libxkbcommon-x11-0 \
    tshark \
    libgstreamer-plugins-good1.0-dev \
    && rm -rf /var/lib/apt/lists/*

# Install rustup to manage Rust toolchains
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none

# Add Rust to PATH
# ENV PATH="/root/.cargo/bin:${PATH}"

# Install uv for Python dependency management
RUN curl -LsSf https://astral.sh/uv/install.sh | sh

# Set working directory (will be mounted from host)
WORKDIR /servo

If using VS code, it is ok to create another file as devcontainer

{
    "name": "Servo Development",
    "image": "servo",
    "workspaceFolder": "/workspace",
    "mounts": [
        "source=${localWorkspaceFolder},target=/workspace,type=bind"
    ],
    "customizations": {
        "vscode": {
            "extensions": [
                "rust-lang.rust-analyzer",
                "ms-python.python",
                "ms-vscode.cpptools"
            ]
        }
    },
    "postCreateCommand": "rustc --version && python --version",
    "remoteUser": "root"
}

After attaching to the container from the VS Code, then simply run ./mach check to check the problem inside the dependencies quickly, than run full compilation ./mach build -d to build the debug version of the code. It is possible to encounter the errors when try to build the program, please look for the solution from servo zulip community and discuss there. Once the build is finished, please run ./mach run then one can use freely the browser as the usual browser like firefox, chromium and safari.