diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9f7fdc6..d00a23a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,8 @@ name: "Docker" on: + workflow_dispatch: + push: branches: ["master"] @@ -11,14 +13,51 @@ permissions: contents: read jobs: + test: + name: "Test (${{ matrix.tag }})" + runs-on: "ubuntu-latest" + strategy: + fail-fast: false + matrix: + include: + - dockerfile: bullseye/Dockerfile + tag: latest + - dockerfile: bookworm/Dockerfile + tag: bookworm + - dockerfile: bookworm/Dockerfile.slim + tag: bookworm-slim + - dockerfile: bullseye/Dockerfile + tag: bullseye + - dockerfile: bullseye/Dockerfile.slim + tag: bullseye-slim + + steps: + - name: "Checkout" + uses: actions/checkout@v6 + + - name: "Set up Docker Buildx" + uses: docker/setup-buildx-action@v4 + + - name: "Build image" + uses: docker/build-push-action@v7 + with: + context: "." + file: "${{ matrix.dockerfile }}" + load: true + tags: "dockette/debian:${{ matrix.tag }}" + + - name: "Test image" + run: "make test TAG=${{ matrix.tag }}" + build: name: "Build" + needs: ["test"] uses: dockette/.github/.github/workflows/docker.yml@master secrets: inherit with: - image: "dockette/debian" - tag: "${{ matrix.tag }}" - dockerfile: "${{ matrix.dockerfile }}" + image: "dockette/debian" + tag: "${{ matrix.tag }}" + dockerfile: "${{ matrix.dockerfile }}" strategy: max-parallel: 3 fail-fast: false @@ -48,3 +87,19 @@ jobs: - dockerfile: stretch/Dockerfile.slim tag: stretch-slim + docs: + name: "Docs" + runs-on: "ubuntu-latest" + needs: ["build"] + if: github.ref == 'refs/heads/master' + + steps: + - name: "Checkout" + uses: actions/checkout@v6 + + - name: "Update Docker Hub description" + uses: peter-evans/dockerhub-description@v5 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: "dockette/debian" diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..5efbfb3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,35 @@ +# AGENTS.md + +## Project + +Base Debian Docker images for Dockette. Images provide a `dfx` user with UID `1000`, `USER_*` environment constants, `/bin/bash` as the default command, and cleanup for smaller layers. + +## Images + +- Docker image: `dockette/debian`. +- Default Makefile build: `bookworm` from `bookworm/Dockerfile` with tag `bookworm`. +- Supported directories include `sid`, `bookworm`, `bullseye`, `buster`, `stretch`, `jessie`, and `wheezy`. +- Standard variants use `Dockerfile`; slim variants use `Dockerfile.slim` and tags like `bookworm-slim`. +- GitHub Actions tests and publishes selected tags, including `latest`, `bookworm`, `bookworm-slim`, `bullseye`, `bullseye-slim`, `buster`, `buster-slim`, `stretch`, and `stretch-slim`. + +## Commands + +- `make build` builds `dockette/debian:${DOCKER_TAG}` from `${DOCKER_VERSION}/Dockerfile`. +- `make build-bookworm-slim` builds a slim variant by overriding `DOCKER_FILE`. +- `make test` verifies the `dfx` user, `USER_NAME`, and `/etc/debian_version` inside the image. +- `make run` opens `/bin/bash` in the selected image. +- Override `DOCKER_VERSION`, `DOCKER_TAG`, and `DOCKER_FILE` when working on a specific variant. + +## Testing + +- Use `make -n build test run` to dry-run the default commands before changing build logic. +- Run the matching `make test-*` target after building any variant that has a test target. +- Keep Makefile targets and workflow matrix entries aligned when adding, removing, or retagging variants. + +## Guidelines + +- Keep Dockerfiles, `Makefile`, README usage examples, and `.github/workflows/docker.yml` tag matrices aligned. +- Prefer `DOCKER_*` names for Docker-related Makefile variables. +- Place `.PHONY: ` directly above each Makefile target. +- Preserve the `dfx` user contract and cleanup pattern unless intentionally changing all variants. +- Do not introduce unrelated formatting or structural changes. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Makefile b/Makefile index 4bb92a8..3b3c474 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,110 @@ -DOCKER_IMAGE=dockette/debian - -_docker-build-%: VERSION=$* -_docker-build-%: - docker buildx \ - build \ - --pull \ - -t ${DOCKER_IMAGE}:${VERSION} \ - ./${VERSION} - -docker-build-sid: _docker-build-sid # dev -docker-build-bookworm: _docker-build-bookworm # 12 -docker-build-bullseye: _docker-build-bullseye # 11 -docker-build-buster: _docker-build-buster # 10 -docker-build-stretch: _docker-build-stretch # 9 -docker-build-jessie: _docker-build-jessie # 8 -docker-build-wheezy: _docker-build-wheezy # 7 +DOCKER_IMAGE ?= dockette/debian +DOCKER_VERSION?=bookworm +DOCKER_TAG?=${DOCKER_VERSION} +DOCKER_FILE?=${DOCKER_VERSION}/Dockerfile + +.PHONY: build +build: + docker buildx build --pull -t ${DOCKER_IMAGE}:${DOCKER_TAG} -f ${DOCKER_FILE} ./${DOCKER_VERSION} + +.PHONY: test +test: + docker run --rm ${DOCKER_IMAGE}:${DOCKER_TAG} sh -lc 'test "$$(id -u dfx)" = "1000" && test "$${USER_NAME}" = "dfx" && test -f /etc/debian_version' + +.PHONY: run +run: + docker run --rm -it ${DOCKER_IMAGE}:${DOCKER_TAG} /bin/bash + +build-sid: DOCKER_VERSION=sid +build-sid: DOCKER_TAG=sid +.PHONY: build-sid +build-sid: build # dev + +build-bookworm: DOCKER_VERSION=bookworm +build-bookworm: DOCKER_TAG=bookworm +.PHONY: build-bookworm +build-bookworm: build # 12 + +build-bookworm-slim: DOCKER_VERSION=bookworm +build-bookworm-slim: DOCKER_TAG=bookworm-slim +build-bookworm-slim: DOCKER_FILE=bookworm/Dockerfile.slim +.PHONY: build-bookworm-slim +build-bookworm-slim: build # 12 + +test-bookworm: DOCKER_TAG=bookworm +.PHONY: test-bookworm +test-bookworm: test # 12 + +test-bookworm-slim: DOCKER_TAG=bookworm-slim +.PHONY: test-bookworm-slim +test-bookworm-slim: test # 12 + +run-bookworm: DOCKER_TAG=bookworm +.PHONY: run-bookworm +run-bookworm: run # 12 + +run-bookworm-slim: DOCKER_TAG=bookworm-slim +.PHONY: run-bookworm-slim +run-bookworm-slim: run # 12 + +build-bullseye: DOCKER_VERSION=bullseye +build-bullseye: DOCKER_TAG=bullseye +.PHONY: build-bullseye +build-bullseye: build # 11 + +build-bullseye-slim: DOCKER_VERSION=bullseye +build-bullseye-slim: DOCKER_TAG=bullseye-slim +build-bullseye-slim: DOCKER_FILE=bullseye/Dockerfile.slim +.PHONY: build-bullseye-slim +build-bullseye-slim: build # 11 + +test-bullseye: DOCKER_TAG=bullseye +.PHONY: test-bullseye +test-bullseye: test # 11 + +test-bullseye-slim: DOCKER_TAG=bullseye-slim +.PHONY: test-bullseye-slim +test-bullseye-slim: test # 11 + +run-bullseye: DOCKER_TAG=bullseye +.PHONY: run-bullseye +run-bullseye: run # 11 + +run-bullseye-slim: DOCKER_TAG=bullseye-slim +.PHONY: run-bullseye-slim +run-bullseye-slim: run # 11 + +build-buster: DOCKER_VERSION=buster +build-buster: DOCKER_TAG=buster +.PHONY: build-buster +build-buster: build # 10 + +build-stretch: DOCKER_VERSION=stretch +build-stretch: DOCKER_TAG=stretch +.PHONY: build-stretch +build-stretch: build # 9 + +build-jessie: DOCKER_VERSION=jessie +build-jessie: DOCKER_TAG=jessie +.PHONY: build-jessie +build-jessie: build # 8 + +build-wheezy: DOCKER_VERSION=wheezy +build-wheezy: DOCKER_TAG=wheezy +.PHONY: build-wheezy +build-wheezy: build # 7 + +.PHONY: docker-build-sid +docker-build-sid: build-sid +.PHONY: docker-build-bookworm +docker-build-bookworm: build-bookworm +.PHONY: docker-build-bullseye +docker-build-bullseye: build-bullseye +.PHONY: docker-build-buster +docker-build-buster: build-buster +.PHONY: docker-build-stretch +docker-build-stretch: build-stretch +.PHONY: docker-build-jessie +docker-build-jessie: build-jessie +.PHONY: docker-build-wheezy +docker-build-wheezy: build-wheezy diff --git a/README.md b/README.md index 87accb9..895c7de 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # Debian +

+ GitHub Actions + Docker Hub pulls + GitHub Sponsors + Support/Discussions +

+ Base docker image based on Debian. Special variants for Sid / Jessie / Wheezy. ------ -[![Docker Stars](https://img.shields.io/docker/stars/dockette/debian.svg?style=flat)](https://hub.docker.com/r/dockette/debian/) -[![Docker Pulls](https://img.shields.io/docker/pulls/dockette/debian.svg?style=flat)](https://hub.docker.com/r/dockette/debian/) - -## Discussion / Help - -[![Join the chat](https://img.shields.io/gitter/room/dockette/dockette.svg?style=flat-square)](https://gitter.im/dockette/dockette?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - ## Image - predefined user `dfx` with UID `1000`