Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
FROM node:8.2.1-alpine

ENV GTT_VERSION 1.7.39
ARG NODE_VERSION=""
FROM node:${NODE_VERSION:-8.2.1-alpine}
ARG [email protected]
ENV GTT_VERSION=$GTT_VERSION
ENV EDITOR vi

WORKDIR /pwd

RUN yarn global add --prefix /usr/local "gitlab-time-tracker@$GTT_VERSION"
RUN apk update && \
apk add git && \
addgroup -S gtt && adduser -S gtt -G gtt && \
yarn global add --prefix /usr/local "gitlab-time-tracker${GTT_VERSION}"
USER gtt
WORKDIR /home/gtt

VOLUME ["/root", "/pwd"]
VOLUME ["/home/gtt"]
ENTRYPOINT ["gtt"]
CMD ["--help"]
32 changes: 14 additions & 18 deletions documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,40 +69,36 @@ you can use the official [Docker image](https://hub.docker.com/r/kriskbx/gitlab-
```shell
docker run \
--rm -it \
-v ~:/root \
-v $(pwd):/pwd \
-v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt \
kriskbx/gitlab-time-tracker \
--help
```

`--rm` removes the container after running, `-it` makes it interactive, `-v ~:/root` mounts your home directory to the
home directory inside the container, `-v $(pwd):/pwd` mounts current directory inside the container to gtt be able to read local config. If you want to store the config in another place, mount another directory:
`--rm` removes the container after running, `-it` makes it interactive, `-v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt ` mounts your gtt configuration directory in the gtt user home directory inside the container. For example, to run a report for a particular user with a date range:

```shell
sudo docker run \
--rm -it \
-v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt \
kriskbx/gitlab-time-tracker \
report "ourorganization/aproject" --user=xxxx --from="2020-04-01" --to="2020-06-30"
```

If you want to store the config in another place, mount another directory:


```shell
docker run \
--rm -it \
-v /path/to/gtt-config:/root \
-v /path/to/gtt-config-dir:/home/gtt/.local/share/.gtt \
kriskbx/gitlab-time-tracker \
--help
```

... or use a Docker volume:

```shell
docker volume create gtt-config

docker run \
--rm -it \
-v gtt-config:/root \
kriskbx/gitlab-time-tracker \
--help
```

I highly recommend creating an alias and adding it to your `bashrc`:

```shell
echo "alias gtt='docker run --rm -it -v ~:/root -v $(pwd):/pwd kriskbx/gitlab-time-tracker'" >>~/.bashrc
echo "alias gtt='docker run --rm -it -v -v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt kriskbx/gitlab-time-tracker'" >>~/.bashrc
```

Now you can simply write `gtt` instead of the bulky Docker command before. Try it out: `gtt --help`
Expand Down