mirror of
https://github.com/decompals/wibo.git
synced 2025-10-16 15:15:10 +00:00
52 lines
1.3 KiB
Docker
52 lines
1.3 KiB
Docker
# Build stage
|
|
FROM ubuntu:24.04 AS build
|
|
|
|
# Install dependencies
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
binutils \
|
|
binutils-mingw-w64-i686 \
|
|
ca-certificates \
|
|
cmake \
|
|
file \
|
|
g++-multilib \
|
|
gcc-mingw-w64-i686 \
|
|
gdb \
|
|
git \
|
|
make \
|
|
ninja-build \
|
|
unzip \
|
|
wget \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy source files
|
|
WORKDIR /wibo
|
|
COPY . /wibo
|
|
|
|
# Build type (Release, Debug, RelWithDebInfo, MinSizeRel)
|
|
ARG BUILD_TYPE=Release
|
|
|
|
# Enable link-time optimization (LTO) (AUTO, ON, OFF)
|
|
ARG ENABLE_LTO=AUTO
|
|
|
|
# Version string (if not provided, defaults to "unknown")
|
|
ARG WIBO_VERSION
|
|
|
|
RUN cmake -S /wibo -B /wibo/build -G Ninja \
|
|
-DCMAKE_BUILD_TYPE:STRING="$BUILD_TYPE" \
|
|
-DWIBO_ENABLE_LIBURING:BOOL=ON \
|
|
-DWIBO_ENABLE_LTO:STRING="$ENABLE_LTO" \
|
|
-DWIBO_VERSION:STRING="$WIBO_VERSION" \
|
|
&& cmake --build /wibo/build --verbose \
|
|
&& ( [ "$BUILD_TYPE" != "Release" ] || strip -g /wibo/build/wibo )
|
|
|
|
# Export binary (usage: docker build -f Dockerfile.ubuntu --target export --output dist .)
|
|
FROM scratch AS export
|
|
COPY --from=build /wibo/build/wibo .
|
|
|
|
# Runnable container
|
|
FROM ubuntu:24.04
|
|
COPY --from=build /wibo/build/wibo /usr/local/sbin/wibo
|
|
CMD ["/usr/local/sbin/wibo"]
|