Skip to content

Commit

Permalink
-use docker to build on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kamchatka-volcano committed Sep 28, 2024
1 parent 7d53e41 commit d987e4c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ jobs:
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=ON -DENABLE_EXAMPLES=ON

- name: Build
if: matrix.config.name == 'Windows Latest MSVC'
run: cmake --build ${{github.workspace}}/build --config Release

- name: Build (Docker)
if: matrix.config.name != 'Windows Latest MSVC'
run: DOCKER_BUILDKIT=1 docker build --output build .

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest
working-directory: ${{github.workspace}}/build/test
run: ./test_hypertextcpp


- name: Prepare examples artifacts
shell: bash
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM alpine:3.18.3 AS hypertextcpp-build-container
RUN apk update && \
apk add --no-cache \
git \
build-base \
cmake

WORKDIR /hypertextcpp_src
COPY external ./external/
COPY src ./src/
COPY tests ./tests/
COPY examples ./examples/
COPY shared_lib_api ./shared_lib_api/
COPY build_shared_template.cmake .
COPY CMakeLists.txt .
RUN cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_EXE_LINKER_FLAGS="-static" -DENABLE_TESTS=ON -DENABLE_EXAMPLES=ON
RUN cmake --build build
RUN strip --strip-all build/hypertextcpp


FROM scratch AS hypertextcpp-build
COPY --from=hypertextcpp-build-container /hypertextcpp_src/build/hypertextcpp .
COPY --from=hypertextcpp-build-container /hypertextcpp_src/build/tests/test_hypertextcpp ./test/
COPY --from=hypertextcpp-build-container /hypertextcpp_src/build/examples ./examples/

0 comments on commit d987e4c

Please # to comment.