diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f019a60..1064ba4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,8 @@ name: "Docker" on: + workflow_dispatch: + push: branches: ["master"] @@ -11,11 +13,61 @@ permissions: contents: read jobs: + test: + name: "Test" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Build image for testing + uses: docker/build-push-action@v7 + with: + context: . + file: ./Dockerfile + push: false + tags: dockette/ssh:latest-test + platforms: linux/amd64 + cache-from: type=gha + cache-to: type=gha,mode=max + load: true + + - name: Test SSH client + run: docker run --rm dockette/ssh:latest-test ssh -V + + - name: Test sshpass + run: docker run --rm dockette/ssh:latest-test sshpass -V + + - name: Test shell availability + run: docker run --rm dockette/ssh:latest-test sh -lc 'command -v sh && command -v bash' + build: name: "Build" + needs: test uses: dockette/.github/.github/workflows/docker.yml@master secrets: inherit with: - image: "dockette/ssh" - tag: "latest" - context: "." + image: "dockette/ssh" + tag: "latest" + context: "." + platforms: "linux/amd64,linux/arm64" + push: ${{ github.ref == 'refs/heads/master' }} + + docs: + name: "Docs" + needs: build + runs-on: ubuntu-latest + 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/ssh diff --git a/Makefile b/Makefile index bec464c..5d21aec 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,16 @@ DOCKER_IMAGE=dockette/ssh +build: docker-build + +test: + docker build -t ${DOCKER_IMAGE}:latest-test . + docker run --rm ${DOCKER_IMAGE}:latest-test ssh -V + docker run --rm ${DOCKER_IMAGE}:latest-test sshpass -V + docker run --rm ${DOCKER_IMAGE}:latest-test sh -lc 'command -v sh && command -v bash' + +run: + docker run -it --rm ${DOCKER_IMAGE} /bin/bash + docker-build: docker buildx \ build \ diff --git a/README.md b/README.md index 47e38af..8fc7eac 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -# SSH +