summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihai Galos <mihai@galos.one>2023-07-05 11:36:22 +0200
committerGitHub <noreply@github.com>2023-07-05 11:36:22 +0200
commitd5e820ade1c3831524a9ad961531729c985fcf45 (patch)
tree3b5c908d450bab6a6d17cac7c85646d619c00886
parent7b86e23bc947a27165a034638842c520eb861f55 (diff)
Feat: Dockerize tokei (#930)
* Dockerize tokei * Update README.md with how to run tokei docker * Simplify compiler flags * Remove superfluous dependency to libgcc * Use Earthfile instead of Dockerfile * Remove superfluous referencing of build step This is not needed because it is implied. Co-authored-by: XAMPPRocky <4464295+XAMPPRocky@users.noreply.github.com> --------- Co-authored-by: XAMPPRocky <4464295+XAMPPRocky@users.noreply.github.com>
-rw-r--r--Earthfile24
-rw-r--r--README.md16
2 files changed, 40 insertions, 0 deletions
diff --git a/Earthfile b/Earthfile
new file mode 100644
index 0000000..5abf22d
--- /dev/null
+++ b/Earthfile
@@ -0,0 +1,24 @@
+VERSION 0.6
+FROM alpine:3.14
+WORKDIR /src
+
+build:
+ FROM rust:alpine3.14
+ RUN apk update \
+ && apk add \
+ git \
+ gcc \
+ g++ \
+ pkgconfig
+
+ COPY . /src
+ WORKDIR /src
+ RUN cargo build --release
+ SAVE ARTIFACT /src/target/release/tokei AS LOCAL ./tokei
+
+docker:
+ COPY +build/tokei /usr/local/bin/
+ WORKDIR /src
+ ENTRYPOINT [ "tokei" ]
+ CMD [ "--help" ]
+ SAVE IMAGE tokei
diff --git a/README.md b/README.md
index 2ffc5fb..e9a1121 100644
--- a/README.md
+++ b/README.md
@@ -297,6 +297,22 @@ Example show total lines:
The server code hosted on tokei.rs is in [XAMPPRocky/tokei_rs](https://github.com/XAMPPRocky/tokei_rs)
+## Dockerized version
+Tokei is available in a small `alpine`-based docker image, buildable through:
+```bash
+earthly +docker
+```
+
+Once built, one can run the image with:
+```bash
+docker run --rm -v /path/to/analyze:/src tokei .
+```
+
+Or, to simply analyze the current folder (linux):
+```bash
+docker run --rm -v $(pwd):/src tokei .
+```
+
## Supported Languages
If there is a language that you would to add to tokei feel free to make a pull