diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml new file mode 100644 index 0000000..4e139e1 --- /dev/null +++ b/.github/workflows/container-image.yml @@ -0,0 +1,50 @@ +name: Build and Push s-tui container image +on: + push: + branches: + - master + workflow_dispatch: {} + # pull_request: + # branches: [ master ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker: + runs-on: ubuntu-latest + steps: + # Allow multi-target builds, uncomment this to use `platfotms` below + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Docker metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v2 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/amd64,linux/s390x,linux/ppc64le,linux/arm64 + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..637bfa9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:3 + +RUN apk add --update stress-ng python3 py3-psutil py3-urwid py3-setuptools + +ADD . s-tui +RUN cd s-tui && python3 setup.py install + +# We could clean-up things if image was squashed +# RUN apk del py3-setuptools && \ +# rm -rf s-tui /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* + +ENTRYPOINT /usr/bin/s-tui