Skip to content

Commit 2a41f6b

Browse files
committed
new docker images
1 parent f58c661 commit 2a41f6b

File tree

7 files changed

+87
-47
lines changed

7 files changed

+87
-47
lines changed

.github/Dockerfile

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

.github/workflows/cd.docker.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@ 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:
25-
- uses: robinraju/release-downloader@v1.11
32+
- uses: robinraju/release-downloader@v1.12
2633
with:
2734
releaseId: ${{ github.event.release.id }}
2835
tag: ${{ github.event.inputs.tag }}
@@ -31,6 +38,10 @@ jobs:
3138
- name: is_latest?
3239
id: latest
3340
run: |
41+
if [ ${{ matrix.variety }} != debian ]; 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
@@ -74,10 +85,11 @@ jobs:
7485
flavor: |
7586
latest=${{ steps.latest.outputs.value }}
7687
tags: |
77-
type=sha
78-
type=semver,pattern=v{{version}},value=${{ github.event.release.tag_name || github.event.inputs.tag }}
79-
type=semver,pattern=v{{major}}.{{minor}},value=${{ github.event.release.tag_name || github.event.inputs.tag }}
80-
type=semver,pattern=v{{major}},value=${{ github.event.release.tag_name || github.event.inputs.tag }}
88+
type=semver,pattern=v{{version}},value=${{ github.event.release.tag_name || github.event.inputs.tag }},enable=${{ matrix.variety == 'debian' }}
89+
type=semver,pattern=v{{major}}.{{minor}},value=${{ github.event.release.tag_name || github.event.inputs.tag }},enable=${{ matrix.variety == 'debian' }}
90+
type=semver,pattern=v{{major}},value=${{ github.event.release.tag_name || github.event.inputs.tag }},enable=${{ matrix.variety == 'debian' }}
91+
type=raw,value=${{ matrix.variety }}
92+
if: ${{ matrix.variety == 'debian' }}
8193

8294
- uses: docker/setup-qemu-action@v3
8395
- uses: docker/setup-buildx-action@v3
@@ -90,6 +102,7 @@ jobs:
90102
docker buildx build \
91103
--push \
92104
$tags \
105+
--tag pkgxdev/pkgx:${{matrix.variety}} \
93106
--platform linux/amd64,linux/arm64 \
94-
--file ./src/.github/Dockerfile \
107+
--file ./src/.github/Dockerfile.${{ matrix.variety }} \
95108
.

.github/workflows/ci.docker.yml

Lines changed: 19 additions & 25 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,51 +15,45 @@ permissions:
1515
packages: write
1616

1717
jobs:
18-
docker-build:
18+
go:
1919
runs-on: ubuntu-latest
20-
container: debian:buster-slim
20+
strategy:
21+
matrix:
22+
variety:
23+
- archlinux
24+
- busybox
25+
- debian
26+
- ubuntu
2127
steps:
2228
- uses: actions/checkout@v4
2329

24-
- run: apt-get update && apt-get install -y curl gcc perl make
25-
26-
- uses: dtolnay/rust-toolchain@stable
27-
- run: cargo build --release
28-
29-
- uses: actions/upload-artifact@v4
30-
with:
31-
name: products
32-
path: ./target/release/pkgx
33-
34-
docker-test:
35-
runs-on: ubuntu-latest
36-
needs: docker-build
37-
steps:
38-
- uses: actions/checkout@v4
39-
40-
- uses: actions/download-artifact@v4
30+
- uses: robinraju/release-downloader@v1.12
4131
with:
42-
name: products
32+
fileName: pkgx-*+linux+x86-64.tar.gz
33+
latest: true
4334

4435
- run: |
4536
mkdir products
46-
mv ./pkgx products/$(uname -m)
37+
tar xzf pkgx*.tar.gz
38+
mv pkgx products/$(uname -m)
4739
curl https://pkgxdev.github.io/pkgm/pkgm.ts -o products/pkgm
4840
4941
- run:
5042
docker build
51-
--tag pkgxdev/pkgx
52-
--file .github/Dockerfile
43+
--tag pkgxdev/${{ matrix.variety }}
44+
--file docker/Dockerfile.${{ matrix.variety }}
5345
.
5446

5547
- run: |
5648
cat <<EoD> Dockerfile
57-
FROM pkgxdev/pkgx
49+
FROM pkgxdev/${{ matrix.variety }}
5850
RUN pkgx --version
5951
RUN if git --version; then exit 1; fi
6052
RUN pkgx git --version
53+
RUN pkgm --version
6154
RUN pkgm install git
6255
RUN if ! git --version; then exit 2; fi
56+
RUN pkgx node --eval "console.log(1)"
6357
EoD
6458
6559
docker build --file Dockerfile .

docker/Dockerfile.archlinux

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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/pkgm /usr/local/bin/
8+
9+
CMD ["/bin/bash"]
10+
ENTRYPOINT ["/usr/local/bin/pkgx"]

docker/Dockerfile.busybox

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM debian:buster-slim 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+
# FIXME a newer glibc would be nice, but the libpthread.so we copy in then fails
7+
FROM busybox:1.31-glibc AS stage1
8+
COPY --from=stage0 /usr/local/bin/pkgx /usr/local/bin/pkgm /usr/local/bin/
9+
10+
# pkgx packages also need libgcc
11+
COPY --from=stage0 /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=stage0 /lib/x86_64-linux-gnu/librt-2.28.so /lib/librt.so.1
14+
COPY --from=stage0 /lib/x86_64-linux-gnu/libdl-2.28.so /lib/libdl.so.2
15+
# we need env for `pkgm`
16+
COPY --from=stage0 /usr/bin/env /usr/bin/env
17+
18+
CMD ["/bin/bash"]
19+
ENTRYPOINT ["/usr/local/bin/pkgx"]

docker/Dockerfile.debian

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM debian:stable-slim 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:stable-slim AS stage1
7+
COPY --from=stage0 /usr/local/bin/pkgx /usr/local/bin/pkgm /usr/local/bin/
8+
9+
CMD ["/bin/bash"]
10+
ENTRYPOINT ["/usr/local/bin/pkgx"]

docker/Dockerfile.ubuntu

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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/pkgm /usr/local/bin/
8+
9+
CMD ["/bin/bash"]
10+
ENTRYPOINT ["/usr/local/bin/pkgx"]

0 commit comments

Comments
 (0)