xuantie-rv-wujian100_open
SUCCESS
21m 05s
History Source
SummaryIterations1Transcript14Dockerfile
Dockerfile53 lines · 1452 chars
# Multi-stage build for wujian100_open project
# Stage 1: builder with development tools
FROM ubuntu:22.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive

# Install common build tools and simulation utilities
RUN apt-get update \
 && apt-get install -y --no-install-recommends \
    build-essential \
    ca-certificates \
    git \
    python3 \
    python3-pip \
    make \
    pkg-config \
    bison \
    flex \
    automake \
    libtool \
    iverilog \
    verilator \
    gtkwave \
    libncurses5-dev \
    libncursesw5-dev \
 && rm -rf /var/lib/apt/lists/*

# Working directory inside the container
WORKDIR /workspace

# Copy the repository into the image
COPY . /workspace

# Environment hints for cross-compilation (may be unused in some repos)
ENV RISCV_TOOLCHAIN=/workspace/riscv_toolchain
ENV PATH="${RISCV_TOOLCHAIN}/bin:${PATH}"

# Attempt to build the project from source if useful tools are present.
# Do not fail the Docker build if compilation fails (builds are best-effort here).
RUN if [ -f Makefile ]; then make -j$(nproc) || true; fi \
 && if [ -d sdk/projects/examples/hello_world ]; then (cd sdk/projects/examples/hello_world && make -j$(nproc) || true); fi

# Stage 2: Runtime image (smaller)
FROM ubuntu:22.04

# Copy the built artifacts from the builder stage
COPY --from=builder /workspace /workspace

WORKDIR /workspace

# Default to an interactive shell to allow users to run commands inside the container
CMD ["bash"]