Skip to content

Commit 6b9dd67

Browse files
committed
new docker images
1 parent fefff85 commit 6b9dd67

7 files changed

Lines changed: 82 additions & 24 deletions

File tree

.github/Dockerfile

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/cd.docker.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ permissions:
1919

2020
jobs:
2121
build-and-push-image:
22+
strategy:
23+
matrix:
24+
variety:
25+
- archlinux
26+
- busybox
27+
- debian
28+
- ubuntu
2229
name: docker buildx pkgxdev/pkgx:${{ github.event.release.tag_name || github.event.inputs.tag }}
2330
runs-on: ubuntu-latest
2431
steps:
@@ -31,6 +38,10 @@ jobs:
3138
- name: is_latest?
3239
id: latest
3340
run: |
41+
if [ ${{ matrix.variety }} != ubuntu ]; then
42+
echo "value=false" >> "${GITHUB_OUTPUT}"
43+
return
44+
fi
3445
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag }}"
3546
LATEST_RELEASE=$(gh api repos/${{ github.repository }}/releases/latest --jq '.tag_name')
3647
if [ "$TAG_NAME" == "$LATEST_RELEASE" ]; then
@@ -91,5 +102,5 @@ jobs:
91102
--push \
92103
$tags \
93104
--platform linux/amd64,linux/arm64 \
94-
--file ./src/.github/Dockerfile \
105+
--file ./src/.github/Dockerfile.${{ matrix.variety }} \
95106
.

.github/workflows/ci.docker.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: ci·docker
33
on:
44
pull_request:
55
paths:
6-
- .github/Dockerfile
6+
- docker/Dockerfile.*
77
- .github/workflows/ci.docker.yml
88

99
concurrency:
@@ -15,7 +15,7 @@ permissions:
1515
packages: write
1616

1717
jobs:
18-
docker-build:
18+
build-pkgx:
1919
runs-on: ubuntu-latest
2020
container: debian:buster-slim
2121
steps:
@@ -31,9 +31,16 @@ jobs:
3131
name: products
3232
path: ./target/release/pkgx
3333

34-
docker-test:
34+
build-docker:
3535
runs-on: ubuntu-latest
36-
needs: docker-build
36+
needs: build-pkgx
37+
strategy:
38+
matrix:
39+
variety:
40+
- archlinux
41+
- busybox
42+
- debian
43+
- ubuntu
3744
steps:
3845
- uses: actions/checkout@v4
3946

@@ -48,13 +55,13 @@ jobs:
4855
4956
- run:
5057
docker build
51-
--tag pkgxdev/pkgx
52-
--file .github/Dockerfile
58+
--tag pkgxdev/${{ matrix.variety }}
59+
--file .github/Dockerfile.${{ matrix.variety }}
5360
.
5461

5562
- run: |
5663
cat <<EoD> Dockerfile
57-
FROM pkgxdev/pkgx
64+
FROM pkgxdev/${{ matrix.variety }}
5865
RUN pkgx --version
5966
RUN if git --version; then exit 1; fi
6067
RUN pkgx git --version

docker/Dockerfile.archlinux

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM archlinux AS stage0
2+
COPY ./products/* /pkgx/
3+
RUN install -m 755 /pkgx/$(uname -m) /usr/local/bin/pkgx
4+
RUN install -m 755 /pkgx/pkgm /usr/local/bin/pkgm
5+
6+
FROM archlinux AS stage1
7+
COPY --from=stage0 /usr/local/bin/pkgx /usr/local/bin/pkgx
8+
COPY --from=stage0 /usr/local/bin/pkgm /usr/local/bin/pkgm
9+
10+
SHELL ["/bin/bash", "-c"]
11+
CMD ["/bin/bash", "-i"]
12+
ENTRYPOINT ["/usr/local/bin/pkgx"]

docker/Dockerfile.busybox

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM debian:buster-slim AS stage1
2+
COPY ./products/* /pkgx/
3+
RUN install -m 755 /pkgx/$(uname -m) /usr/local/bin/pkgx
4+
RUN install -m 755 /pkgx/pkgm /usr/local/bin/pkgm
5+
6+
FROM busybox:glibc AS stage2
7+
COPY --from=stage1 /usr/local/bin/pkgx /usr/local/bin/pkgx
8+
COPY --from=stage1 /usr/local/bin/pkgm /usr/local/bin/pkgm
9+
10+
# pkgx packages also need libgcc
11+
COPY --from=stage1 /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib/libgcc_s.so.1
12+
# these are part of glibc but for some reason this image doesn’t have them
13+
COPY --from=stage1 /lib/x86_64-linux-gnu/librt-2.28.so /lib/librt.so.1
14+
COPY --from=stage1 /lib/x86_64-linux-gnu/libdl-2.28.so /lib/libdl.so.2
15+
# we need env for `pkgm`
16+
COPY --from=stage1 /usr/bin/env /usr/bin/env
17+
18+
SHELL ["/bin/sh", "-c"]
19+
CMD ["/bin/sh", "-i"]
20+
ENTRYPOINT ["/usr/local/bin/pkgx"]

docker/Dockerfile.debian

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM debian AS stage0
2+
COPY ./products/* /pkgx/
3+
RUN install -m 755 /pkgx/$(uname -m) /usr/local/bin/pkgx
4+
RUN install -m 755 /pkgx/pkgm /usr/local/bin/pkgm
5+
6+
FROM debian AS stage1
7+
COPY --from=stage0 /usr/local/bin/pkgx /usr/local/bin/pkgx
8+
COPY --from=stage0 /usr/local/bin/pkgm /usr/local/bin/pkgm
9+
10+
SHELL ["/bin/bash", "-c"]
11+
CMD ["/bin/bash", "-i"]
12+
ENTRYPOINT ["/usr/local/bin/pkgx"]

docker/Dockerfile.ubuntu

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu AS stage0
2+
COPY ./products/* /pkgx/
3+
RUN install -m 755 /pkgx/$(uname -m) /usr/local/bin/pkgx
4+
RUN install -m 755 /pkgx/pkgm /usr/local/bin/pkgm
5+
6+
FROM ubuntu AS stage1
7+
COPY --from=stage0 /usr/local/bin/pkgx /usr/local/bin/pkgx
8+
COPY --from=stage0 /usr/local/bin/pkgm /usr/local/bin/pkgm
9+
10+
SHELL ["/bin/bash", "-c"]
11+
CMD ["/bin/bash", "-i"]
12+
ENTRYPOINT ["/usr/local/bin/pkgx"]

0 commit comments

Comments
 (0)