Skip to content

Commit be9dd53

Browse files
authored
Merge pull request #379 from aminya/alpine
feat: support Alpine + add setup-alpine package + detect externally managed python
2 parents 8e78c54 + 2e04f42 commit be9dd53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+737
-69
lines changed

.github/workflows/CI.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ jobs:
244244
- { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "20.04", tag: "20.04-1.3.0" }
245245
- { distro: "fedora", image: "setup-cpp-fedora", tag: "40-1.3.0" }
246246
- { distro: "arch", image: "setup-cpp-arch", tag: "base-1.3.0" }
247+
- { distro: "alpine", image: "setup-cpp-alpine", BASE_VERSION: "22-alpine3.21", tag: "3.21-1.3.0" }
247248
include:
248249
- os: ubuntu-24.04-arm
249250
platform: linux/arm64
@@ -254,6 +255,9 @@ jobs:
254255
- os: ubuntu-24.04-arm
255256
platform: linux/arm64
256257
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "20.04", tag: "20.04-1.3.0" }
258+
- os: ubuntu-24.04-arm
259+
platform: linux/arm64
260+
container: { distro: "alpine", image: "setup-cpp-alpine", BASE_VERSION: "22-alpine3.21", tag: "3.21-1.3.0" }
257261
steps:
258262
- uses: actions/checkout@v4
259263
with:
@@ -300,7 +304,7 @@ jobs:
300304
docker tag aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}:latest
301305
302306
- name: Push latest to Docker Hub
303-
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
307+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'alpine' }}
304308
run: docker push aminya/${{ matrix.container.image }}:latest
305309

306310
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}
@@ -331,7 +335,7 @@ jobs:
331335
docker tag aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-llvm:latest
332336
333337
- name: Push latest to Docker Hub
334-
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
338+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'alpine' }}
335339
run: docker push aminya/${{ matrix.container.image }}-llvm:latest
336340

337341
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-llvm
@@ -372,7 +376,7 @@ jobs:
372376
docker tag aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-gcc:latest
373377
374378
- name: Push latest to Docker Hub
375-
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
379+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'alpine' }}
376380
run: docker push aminya/${{ matrix.container.image }}-gcc:latest
377381

378382
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-gcc
@@ -396,7 +400,7 @@ jobs:
396400

397401
- name: Build setup-cpp-${{matrix.container.distro }}-mingw
398402
id: build_mingw
399-
if: ${{ matrix.container.distro != 'fedora' }}
403+
if: ${{ matrix.container.distro != 'fedora' && !(matrix.container.distro == 'alpine' && matrix.platform == 'linux/arm64') }}
400404
uses: docker/build-push-action@v6
401405
with:
402406
context: .
@@ -410,16 +414,16 @@ jobs:
410414
cache-to: type=inline
411415

412416
- name: Tag latest locally
413-
if: ${{ matrix.container.distro != 'fedora' }}
417+
if: ${{ matrix.container.distro != 'fedora' && !(matrix.container.distro == 'alpine' && matrix.platform == 'linux/arm64') }}
414418
run: |
415419
docker tag aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-mingw:latest
416420
417421
- name: Push latest to Docker Hub
418-
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'fedora' }}
422+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'fedora' && matrix.container.distro != 'alpine' }}
419423
run: docker push aminya/${{ matrix.container.image }}-mingw:latest
420424

421425
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-mingw
422-
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'fedora' }}
426+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'fedora' && !(matrix.container.distro == 'alpine' && matrix.platform == 'linux/arm64') }}
423427
uses: peter-evans/dockerhub-description@v4
424428
with:
425429
username: aminya
@@ -428,7 +432,7 @@ jobs:
428432
readme-filepath: ./README_DOCKER.md
429433

430434
- name: Test Mingw
431-
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && matrix.container.distro != 'fedora' }}
435+
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && matrix.container.distro != 'fedora' && matrix.container.distro != 'alpine' }}
432436
uses: docker/build-push-action@v6
433437
with:
434438
context: .
@@ -459,6 +463,11 @@ jobs:
459463
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04-1.3.0", suffix: "-llvm", latest: true }
460464
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04-1.3.0", suffix: "-gcc", latest: true }
461465
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04-1.3.0", suffix: "-mingw", latest: true }
466+
467+
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21-1.3.0", suffix: "", latest: true }
468+
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21-1.3.0", suffix: "-llvm", latest: true }
469+
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21-1.3.0", suffix: "-gcc", latest: true }
470+
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21-1.3.0", suffix: "-mingw", latest: true }
462471
steps:
463472
- name: Set up Docker Buildx
464473
uses: docker/setup-buildx-action@v3

dev/docker/ci/alpine-gcc.dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM aminya/setup-cpp-alpine:latest AS setup-cpp-alpine-gcc
2+
3+
# install gcc
4+
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
5+
--compiler gcc && \
6+
# cleanup
7+
rm -rf /var/cache/apk/*
8+
9+
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
10+
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]

dev/docker/ci/alpine-llvm.dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM aminya/setup-cpp-alpine:latest AS setup-cpp-alpine-llvm
2+
3+
# install llvm
4+
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
5+
--compiler llvm && \
6+
# cleanup
7+
rm -rf /var/cache/apk/*
8+
9+
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
10+
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]

dev/docker/ci/alpine-mingw.dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM aminya/setup-cpp-alpine:latest AS setup-cpp-alpine-mingw
2+
3+
# install mingw/powershell
4+
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
5+
--compiler mingw \
6+
--powershell true && \
7+
# cleanup
8+
rm -rf /var/cache/apk/*
9+
10+
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
11+
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]

dev/docker/ci/alpine.dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
ARG BASE_VERSION=22-alpine3.21
2+
3+
#### Base Image with Node.js
4+
FROM --platform=$BUILDPLATFORM node:${BASE_VERSION} AS alpine-nodejs
5+
6+
#### Base Image with Tools
7+
FROM alpine-nodejs AS setup-cpp-alpine
8+
9+
COPY "./dist/modern" "/usr/lib/setup-cpp/"
10+
11+
# install the cpp tools
12+
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
13+
--cmake true \
14+
--ninja true \
15+
--task true \
16+
--python true \
17+
--make true \
18+
--cppcheck true \
19+
--gcovr true \
20+
--doxygen true \
21+
--vcpkg true \
22+
--ccache true \
23+
--conan true \
24+
--cmakelang true \
25+
--meson true && \
26+
# cleanup
27+
rm -rf /var/cache/apk/*
28+
29+
# Custom entrypoint due to bash -l limitations on Alpine
30+
RUN printf '#!/bin/bash\nsource $HOME/.cpprc\nexec "$@"\n' > /entrypoint.sh && \
31+
chmod +x /entrypoint.sh
32+
33+
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
34+
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#### Building (example)
2+
FROM aminya/setup-cpp-alpine-gcc AS builder
3+
4+
COPY ./dev/cpp_vcpkg_project /home/app
5+
WORKDIR /home/app
6+
RUN task build
7+
8+
#### Running environment
9+
# use a fresh image as the runner
10+
FROM alpine:3.21 AS runner
11+
12+
# copy the built binaries and their runtime dependencies
13+
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
14+
WORKDIR /home/app/
15+
ENTRYPOINT ["./my_exe"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#### Building (example)
2+
FROM aminya/setup-cpp-alpine-llvm AS builder
3+
4+
COPY ./dev/cpp_vcpkg_project /home/app
5+
WORKDIR /home/app
6+
RUN task build
7+
8+
#### Running environment
9+
# use a fresh image as the runner
10+
FROM alpine:3.21 AS runner
11+
12+
# copy the built binaries and their runtime dependencies
13+
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
14+
WORKDIR /home/app/
15+
ENTRYPOINT ["./my_exe"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#### Cross Building (example)
2+
FROM aminya/setup-cpp-alpine-mingw AS builder-mingw
3+
4+
COPY ./dev/cpp_vcpkg_project /home/app
5+
WORKDIR /home/app
6+
RUN bash -c 'source ~/.cpprc \
7+
&& task build_cross_mingw'

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)