diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 0000000..791d5b6 --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,50 @@ +name: Build multi-arch Docker Image + +on: + release: + types: [published] + push: + branches: [master] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Login to Docker Hub + # Only if we need to push an image + if: ${{ github.event_name == 'release' && github.event.action == 'published' }} + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # Setup for buildx + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + image: tonistiigi/binfmt:qemu-v6.0.0-12 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + version: v0.6.1 + + # Debugging information + - name: Docker info + run: docker info + - name: Buildx inspect + run: docker buildx inspect + + # Build and (optionally) push the image + - name: Build image + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x + # Only push if we are publishing a release + push: ${{ github.event_name == 'release' && github.event.action == 'published' }} + # Use a 'temp' tag, that won't be pushed, for non-release builds + tags: testcontainers/sshd:${{ github.event.release.tag_name || 'temp' }} diff --git a/Dockerfile b/Dockerfile index 5c48c82..35e627b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ -FROM alpine:3.5 +FROM alpine:3.16.0 RUN apk add --no-cache openssh && ssh-keygen -A && echo 'root:root' | chpasswd