From f3a4f446b9e02d3ae04717e0ce355ae8684da206 Mon Sep 17 00:00:00 2001 From: "Aleksandar N. Kostadinov" Date: Thu, 5 May 2022 19:11:20 +0300 Subject: [PATCH 1/2] Build container images for s-tui --- .github/workflows/container-image.yml | 50 +++++++++++++++++++++++++++ Dockerfile | 28 +++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/container-image.yml create mode 100644 Dockerfile 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..c9f9a8d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:3 as stress + +RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ + apk add --update build-base libaio-dev libattr libbsd-dev libcap-dev libcap-dev libgcrypt-dev jpeg-dev judy-dev@testing keyutils-dev lksctp-tools-dev libatomic zlib-dev kmod-dev xxhash-dev git && \ + git clone --branch V0.14.00 --depth 1 https://github.com/ColinIanKing/stress-ng.git && \ + cd stress-ng && mkdir install-root && \ + make && make DESTDIR=install-root/ install + + +####### actual image ######## + +FROM alpine:3 + +RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ + apk add --update libaio libattr libbsd libcap libcap libgcrypt jpeg judy@testing keyutils lksctp-tools libatomic zlib kmod-dev xxhash-dev && \ + apk add --update python3 py3-psutil py3-urwid && \ + apk add --update py3-setuptools # for installing python package + +COPY --from=stress stress-ng/install-root/ / + +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 From ea9ae0bca50de833e7d4f7667616ccf376f69560 Mon Sep 17 00:00:00 2001 From: "Aleksandar N. Kostadinov" Date: Mon, 12 Sep 2022 16:05:41 +0300 Subject: [PATCH 2/2] simplify stress-ng installation Alpine 3 has stress-ng already in repos. It is not compiled with all option but it has everything needed for s-tui. That's why I think simplicity makes more sense here. --- Dockerfile | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index c9f9a8d..637bfa9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,6 @@ -FROM alpine:3 as stress - -RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ - apk add --update build-base libaio-dev libattr libbsd-dev libcap-dev libcap-dev libgcrypt-dev jpeg-dev judy-dev@testing keyutils-dev lksctp-tools-dev libatomic zlib-dev kmod-dev xxhash-dev git && \ - git clone --branch V0.14.00 --depth 1 https://github.com/ColinIanKing/stress-ng.git && \ - cd stress-ng && mkdir install-root && \ - make && make DESTDIR=install-root/ install - - -####### actual image ######## - FROM alpine:3 -RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ - apk add --update libaio libattr libbsd libcap libcap libgcrypt jpeg judy@testing keyutils lksctp-tools libatomic zlib kmod-dev xxhash-dev && \ - apk add --update python3 py3-psutil py3-urwid && \ - apk add --update py3-setuptools # for installing python package - -COPY --from=stress stress-ng/install-root/ / +RUN apk add --update stress-ng python3 py3-psutil py3-urwid py3-setuptools ADD . s-tui RUN cd s-tui && python3 setup.py install