mirror of https://github.com/decompals/wibo.git
Build static binary (#29)
This commit is contained in:
parent
aec6f0dbe9
commit
67f99ba1b2
|
@ -4,25 +4,18 @@ jobs:
|
||||||
build_and_test:
|
build_and_test:
|
||||||
name: Build and test
|
name: Build and test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: ubuntu:focal
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install GCC multilib
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
apt-get install -y cmake file gcc-multilib g++-multilib unzip wget
|
sudo apt-get install -y file unzip wget
|
||||||
|
|
||||||
- name: Configure
|
|
||||||
# Replace with RelWithDebInfo when -O2 crash is fixed
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Debug
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build build
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
run: docker build --target export --output build .
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
|
|
31
Dockerfile
31
Dockerfile
|
@ -1,26 +1,23 @@
|
||||||
FROM ubuntu:20.04 as build
|
# Build stage
|
||||||
|
FROM --platform=linux/i386 alpine:latest AS build
|
||||||
|
|
||||||
RUN apt-get update \
|
# Install dependencies
|
||||||
&& apt-get install -y --no-install-recommends \
|
RUN apk add --no-cache cmake ninja g++ linux-headers binutils
|
||||||
g++ \
|
|
||||||
g++-multilib \
|
|
||||||
cmake \
|
|
||||||
ninja-build
|
|
||||||
|
|
||||||
|
# Copy source files
|
||||||
COPY . /wibo
|
COPY . /wibo
|
||||||
|
|
||||||
|
# Build static binary
|
||||||
# Replace with RelWithDebInfo when -O2 crash is fixed
|
# Replace with RelWithDebInfo when -O2 crash is fixed
|
||||||
RUN cmake -S /wibo -B /wibo/build -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
RUN cmake -S /wibo -B /wibo/build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-static" \
|
||||||
RUN cmake --build /wibo/build
|
&& cmake --build /wibo/build \
|
||||||
|
&& strip -g /wibo/build/wibo
|
||||||
|
|
||||||
|
# Export binary (usage: docker build --target export --output build .)
|
||||||
|
FROM scratch AS export
|
||||||
|
COPY --from=build /wibo/build/wibo .
|
||||||
|
|
||||||
FROM ubuntu:22.04
|
# Runnable container
|
||||||
|
FROM alpine:latest
|
||||||
RUN dpkg --add-architecture i386 \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
libstdc++6:i386
|
|
||||||
|
|
||||||
COPY --from=build /wibo/build/wibo /usr/local/sbin/wibo
|
COPY --from=build /wibo/build/wibo /usr/local/sbin/wibo
|
||||||
|
|
||||||
CMD /usr/local/sbin/wibo
|
CMD /usr/local/sbin/wibo
|
||||||
|
|
Loading…
Reference in New Issue