Skip to content

Commit

Permalink
feat(#12): prepare docker image
Browse files Browse the repository at this point in the history
- prepare a musl based docker image
- extend the ci release pipeline to build and publish the docker image as well
- extend the docs for the docker usage
  • Loading branch information
sassman committed Mar 16, 2022
1 parent 41fab25 commit 6955ad4
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
@@ -0,0 +1,3 @@
*
!src
!Cargo.*
21 changes: 21 additions & 0 deletions .github/workflows/deploy-to-dockerhub.yml
@@ -0,0 +1,21 @@
name: Deploy to DockerHub
on:
workflow_dispatch:

jobs:
publish:
name: docker build & push
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: make image
run: make image
- name: make publish
run: make publish
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Expand Up @@ -14,7 +14,7 @@ jobs:

publish:
name: post / cargo publish
needs: [audit, lint, tests]
needs: doing-a-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -28,6 +28,10 @@ jobs:
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-to-dockerhub:
needs: publish
uses: sassman/ssd-benchmark-rs/.github/workflows/deploy-to-dockerhub.yml@main

# https://github.com/marketplace/actions/changelog-reader
release:
name: post / github release
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
@@ -0,0 +1,17 @@
FROM ekidd/rust-musl-builder:latest as builder

ADD --chown=rust:rust . ./
RUN cargo build --release

# final image
FROM alpine:latest

LABEL name="ssd-benchmark"
LABEL repository="https://github.com/sassman/ssd-benchmark-rs"
LABEL homepage="https://github.com/sassman/ssd-benchmark-rs"
LABEL maintainer="Sven Assmann"

COPY .docker/entrypoint.sh /entrypoint.sh
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/ssd-benchmark \
/usr/local/bin/
CMD /usr/local/bin/ssd-benchmark
12 changes: 12 additions & 0 deletions Makefile
@@ -0,0 +1,12 @@
VERSION:=latest
SLUG:=ssd-benchmark

image-m1:
docker build -t 5422m4n/${SLUG}:${VERSION} .
image:
docker build --platform linux/amd64 \
-t 5422m4n/${SLUG}:${VERSION} .
publish:
docker push 5422m4n/${SLUG}:latest
use:
docker run --rm 5422m4n/${SLUG}
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -17,14 +17,20 @@ This tool has just one single purpose, it measures the writing performance of yo

It used random data and writes first sequentially chunks of 8MB until a total 1GB is written. It measures writing time and throughput.

After that it writes this random data 8 times again on disk and measures the average writing times and throughput for this.
After that, it writes these random data 8 times again on disk and measures the average writing times and throughput for this.

## Demo

![demo](./docs/demo.gif)

## Quick Start

### Using the docker image

```sh
docker run --rm 5422m4n/ssd-benchmark
```

### Install on linux

[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/ssd-benchmark)
Expand Down

0 comments on commit 6955ad4

Please sign in to comment.