30 lines
700 B
Docker
30 lines
700 B
Docker
ARG TARGET
|
|
|
|
FROM debian:bookworm AS deps
|
|
|
|
# possible values: x64, arm64
|
|
ARG ARCH=x64
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
|
apt-get install -y make clang libgmock-dev gdb curl ninja-build && \
|
|
apt-get clean && rm -rf /var/lib/apt/lists
|
|
RUN cd /opt && curl -L https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/xpack-riscv-none-elf-gcc-14.2.0-3-linux-${ARCH}.tar.gz | tar -xz
|
|
|
|
|
|
FROM deps AS dev
|
|
|
|
|
|
FROM deps AS build
|
|
ARG TARGET=${TARGET}
|
|
|
|
ADD . /workspace
|
|
WORKDIR /workspace
|
|
|
|
RUN ./configure --version=${VERSION} && ninja -C build ../out/${TARGET}
|
|
|
|
|
|
FROM scratch AS export
|
|
ARG TARGET=${TARGET}
|
|
|
|
COPY --from=build /workspace/out/${TARGET} /
|