diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml new file mode 100644 index 0000000..3dd867a --- /dev/null +++ b/.github/workflows/image.yaml @@ -0,0 +1,50 @@ +name: Image + +on: + push: + branches: + - main + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + docker: ${{ steps.filter.outputs.docker }} + steps: + - uses: actions/checkout@v4 + + - name: Check for Dockerfile changes + id: filter + uses: dorny/paths-filter@v3 + with: + filters: | + docker: + - 'Dockerfile' + build: + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.docker != '' }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up QEMU (enable cross-arch) + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Quay + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + platforms: linux/amd64,linux/arm64 + tags: | + quay.io/akuity/stress-ng:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b167797 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM debian:bullseye AS builder + +RUN apt-get update && apt-get install -yq make gcc busybox-static + +WORKDIR /code +ENV STRESS_VER=0.09.41 +ADD https://github.com/ColinIanKing/stress-ng/archive/V${STRESS_VER}.tar.gz . +RUN tar -xf V${STRESS_VER}.tar.gz && mv stress-ng-${STRESS_VER} stress-ng + +# make static version +WORKDIR /code/stress-ng +RUN STATIC=1 make + +# Final image +FROM scratch + +# copy stress-ng +COPY --from=builder /code/stress-ng/stress-ng / + +# copy static sleep +COPY --from=builder /bin/busybox /bin/sleep + +ENTRYPOINT ["/stress-ng"] \ No newline at end of file diff --git a/oom-demo/manifest.yaml b/oom-demo/manifest.yaml index cd156f4..0eb33e8 100644 --- a/oom-demo/manifest.yaml +++ b/oom-demo/manifest.yaml @@ -23,9 +23,7 @@ spec: - 150M - '--vm-hang' - '1' - command: - - stress - image: polinux/stress + image: quay.io/akuity/stress-ng imagePullPolicy: IfNotPresent name: oom startupProbe: