Skip to content

Commit 701c660

Browse files
authored
Merge pull request #48 from echohello-dev/codex/issue-20-docker-musl-image
feat(release): add docker musl image packaging
2 parents 47a616b + 64a063a commit 701c660

7 files changed

Lines changed: 143 additions & 2 deletions

File tree

‎.dockerignore‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.git
2+
.github
3+
docs
4+
node_modules
5+
skills
6+
src
7+
tests
8+
scripts
9+
AGENTS.md
10+
README.md
11+
package.json
12+
bun.lock
13+
tsconfig.json
14+
.mise.toml
15+
dist/*
16+
!dist/skillet-linux-x64-musl
17+
!dist/skillet-linux-arm64-musl
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Docker Image
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
packages: write
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
17+
env:
18+
IMAGE: ghcr.io/${{ github.repository_owner }}/skillet
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
23+
24+
- name: Setup mise
25+
uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac
26+
27+
- name: Resolve image tag
28+
id: vars
29+
shell: bash
30+
run: |
31+
set -euo pipefail
32+
if [[ "${GITHUB_REF_TYPE:-}" == "tag" ]]; then
33+
TAG="${GITHUB_REF_NAME#v}"
34+
else
35+
TAG="sha-${GITHUB_SHA::7}"
36+
fi
37+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
38+
39+
- name: Build musl binaries
40+
run: mise run build -- --targets=linux-x64-musl,linux-arm64-musl
41+
42+
- name: Authenticate to GHCR
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
47+
48+
- name: Build and push multi-arch image
49+
shell: bash
50+
run: |
51+
set -euo pipefail
52+
docker buildx create --name skillet-builder --use || docker buildx use skillet-builder
53+
docker buildx build \
54+
--platform linux/amd64,linux/arm64 \
55+
--tag "$IMAGE:${{ steps.vars.outputs.tag }}" \
56+
--push \
57+
.
58+
59+
- name: Tag image as latest
60+
if: github.event_name == 'release'
61+
shell: bash
62+
run: |
63+
set -euo pipefail
64+
docker buildx imagetools create \
65+
--tag "$IMAGE:latest" \
66+
"$IMAGE:${{ steps.vars.outputs.tag }}"

‎.mise.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ run = "mise run install && bun scripts/render-chocolatey-package.ts"
2424

2525
[tasks.render-winget-manifest]
2626
run = "mise run install && bun scripts/render-winget-manifest.ts"
27+
28+
[tasks.docker-smoke]
29+
run = "mise run build -- --targets=linux-x64-musl,linux-arm64-musl && docker build --platform=linux/amd64 -t skillet:local . && docker run --rm --platform=linux/amd64 skillet:local --help"

‎Dockerfile‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# syntax=docker/dockerfile:1.7
2+
FROM alpine:3.22
3+
4+
ARG TARGETARCH
5+
6+
RUN apk add --no-cache libstdc++ libgcc
7+
8+
COPY dist/skillet-linux-x64-musl /tmp/skillet-linux-x64-musl
9+
COPY dist/skillet-linux-arm64-musl /tmp/skillet-linux-arm64-musl
10+
11+
RUN set -eux; \
12+
case "$TARGETARCH" in \
13+
amd64) cp /tmp/skillet-linux-x64-musl /usr/local/bin/skillet ;; \
14+
arm64) cp /tmp/skillet-linux-arm64-musl /usr/local/bin/skillet ;; \
15+
*) echo "Unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;; \
16+
esac; \
17+
chmod +x /usr/local/bin/skillet; \
18+
rm -f /tmp/skillet-linux-x64-musl /tmp/skillet-linux-arm64-musl
19+
20+
ENTRYPOINT ["/usr/local/bin/skillet"]
21+
CMD ["--help"]

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Skillet installs, discovers, and updates `SKILL.md`-based skills across supporte
1313
| Chocolatey | `choco install skillet` | Configured |
1414
| winget | `winget install skillet` | Configured |
1515
| npm / npx | `npx skillet ...` | Planned |
16-
| Docker | `docker run ... skillet ...` | Planned |
16+
| Docker | `docker run ... skillet ...` | Configured |
1717
| Local dev | `mise run dev -- --help` | Available |
1818

1919
Current development workflow:
@@ -144,3 +144,4 @@ Distribution docs:
144144
- Homebrew: `docs/distribution/homebrew.md`
145145
- Chocolatey: `docs/distribution/chocolatey.md`
146146
- winget: `docs/distribution/winget.md`
147+
- Docker: `docs/distribution/docker.md`

‎docs/distribution/docker.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Docker Distribution
2+
3+
Skillet publishes a Linux musl-based container image with `skillet` as the entrypoint.
4+
5+
## Build Inputs
6+
7+
The image requires these release artifacts in `dist/`:
8+
9+
- `skillet-linux-x64-musl`
10+
- `skillet-linux-arm64-musl`
11+
12+
## Local Build and Test
13+
14+
```bash
15+
mise run build -- --targets=linux-x64-musl,linux-arm64-musl
16+
docker build --platform=linux/amd64 -t skillet:local .
17+
docker run --rm skillet:local --help
18+
```
19+
20+
## Publish (GHCR)
21+
22+
```bash
23+
docker buildx build \
24+
--platform linux/amd64,linux/arm64 \
25+
-t ghcr.io/echohello-dev/skillet:<version> \
26+
-t ghcr.io/echohello-dev/skillet:latest \
27+
--push .
28+
```
29+
30+
Repository automation:
31+
32+
- `.github/workflows/docker-image.yaml` publishes `ghcr.io/<owner>/skillet:<version>` on release.

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"build": "bun scripts/build-release.ts",
1313
"render:homebrew": "bun scripts/render-homebrew-formula.ts",
1414
"render:choco": "bun scripts/render-chocolatey-package.ts",
15-
"render:winget": "bun scripts/render-winget-manifest.ts"
15+
"render:winget": "bun scripts/render-winget-manifest.ts",
16+
"docker:smoke": "mise run docker-smoke"
1617
},
1718
"dependencies": {
1819
"cac": "^6.7.14",

0 commit comments

Comments
 (0)