Skip to content

Commit

Permalink
Feat: Dockerize tokei (#930)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
mihaigalos and XAMPPRocky authored Jul 5, 2023
1 parent 7b86e23 commit d5e820a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d5e820a

Please sign in to comment.