Skip to content

Commit 3c59d52

Browse files
committed
new docker images
1 parent 028f1bb commit 3c59d52

File tree

7 files changed

+93
-49
lines changed

7 files changed

+93
-49
lines changed

.github/Dockerfile

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

.github/workflows/cd.docker.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: cd·docker
2+
run-name: cd·docker:${{ github.event.release.tag_name || github.event.inputs.tag }}
23

34
on:
45
release:
@@ -19,10 +20,20 @@ permissions:
1920

2021
jobs:
2122
build-and-push-image:
22-
name: docker buildx pkgxdev/pkgx:${{ github.event.release.tag_name || github.event.inputs.tag }}
23+
strategy:
24+
matrix:
25+
x:
26+
- variety: archlinux
27+
platforms: linux/amd64
28+
- variety: busybox
29+
platforms: linux/amd64
30+
- variety: debian
31+
platforms: linux/amd64,linux/arm64
32+
- variety: ubuntu
33+
platforms: linux/amd64,linux/arm64
2334
runs-on: ubuntu-latest
2435
steps:
25-
- uses: robinraju/release-downloader@v1.11
36+
- uses: robinraju/release-downloader@v1.12
2637
with:
2738
releaseId: ${{ github.event.release.id }}
2839
tag: ${{ github.event.inputs.tag }}
@@ -31,6 +42,10 @@ jobs:
3142
- name: is_latest?
3243
id: latest
3344
run: |
45+
if [ ${{ matrix.x.variety }} != debian ]; then
46+
echo "value=false" >> "${GITHUB_OUTPUT}"
47+
exit
48+
fi
3449
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag }}"
3550
LATEST_RELEASE=$(gh api repos/${{ github.repository }}/releases/latest --jq '.tag_name')
3651
if [ "$TAG_NAME" == "$LATEST_RELEASE" ]; then
@@ -74,10 +89,11 @@ jobs:
7489
flavor: |
7590
latest=${{ steps.latest.outputs.value }}
7691
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 }}
92+
type=semver,pattern=v{{version}},value=${{ github.event.release.tag_name || github.event.inputs.tag }},enable=${{ matrix.x.variety == 'debian' }}
93+
type=semver,pattern=v{{major}}.{{minor}},value=${{ github.event.release.tag_name || github.event.inputs.tag }},enable=${{ matrix.x.variety == 'debian' }}
94+
type=semver,pattern=v{{major}},value=${{ github.event.release.tag_name || github.event.inputs.tag }},enable=${{ matrix.x.variety == 'debian' }}
95+
type=raw,value=${{ matrix.x.variety }}
96+
if: ${{ matrix.x.variety == 'debian' }}
8197

8298
- uses: docker/setup-qemu-action@v3
8399
- uses: docker/setup-buildx-action@v3
@@ -90,6 +106,7 @@ jobs:
90106
docker buildx build \
91107
--push \
92108
$tags \
93-
--platform linux/amd64,linux/arm64 \
94-
--file ./src/.github/Dockerfile \
109+
--tag pkgxdev/pkgx:${{matrix.x.variety}} \
110+
--platform ${{matrix.x.platforms}} \
111+
--file ./src/docker/Dockerfile.${{ matrix.x.variety }} \
95112
.

.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)