Skip to content

Commit fcb23c7

Browse files
committed
Add Docker support
1 parent 407f60c commit fcb23c7

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/**

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:8.2.1-alpine
2+
3+
ENV GTT_VERSION 1.5.1
4+
5+
RUN yarn global add --prefix /usr/local "gitlab-time-tracker@$GTT_VERSION"
6+
7+
VOLUME ["/root"]
8+
ENTRYPOINT ["gtt"]
9+
CMD ["--help"]

readme.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ stored on GitLab.
1313
* [requirements](#requirements)
1414
* [installation](#installation)
1515
* [updating](#updating)
16+
* [docker](#docker)
1617
* [commands](#commands)
1718
* [I) configuration](#i-configuration)
1819
* [II) time tracking](#ii-time-tracking)
@@ -74,6 +75,54 @@ yarn global upgrade gitlab-time-tracker
7475
npm install -g gitlab-time-tracker
7576
```
7677

78+
## docker
79+
80+
You don't need to have node and gtt installed on your system in order to use gtt,
81+
you can use the official [Docker image](https://hub.docker.com/r/kriskbx/gitlab-time-tracker) as well:
82+
83+
```shell
84+
docker run \
85+
--rm -it \
86+
-v ~:/root \
87+
kriskbx/gitlab-time-tracker \
88+
--help
89+
```
90+
91+
`--rm` removes the container after running, `-it` makes it interactive, `-v ~:/root` mounts your home directory to the
92+
home directory inside the container. If you want to store the config in another place, mount another directory:
93+
94+
95+
```shell
96+
docker run \
97+
--rm -it \
98+
-v /path/to/gtt-config:/root \
99+
kriskbx/gitlab-time-tracker \
100+
--help
101+
```
102+
103+
... or use a Docker volume:
104+
105+
```shell
106+
docker volume create gtt-config
107+
108+
docker run \
109+
--rm -it \
110+
-v gtt-config:/root \
111+
kriskbx/gitlab-time-tracker \
112+
--help
113+
```
114+
115+
I highly recommend creating an alias and adding it to your `bashrc`:
116+
117+
```shell
118+
echo "alias gtt='docker run --rm -it -v ~:/root kriskbx/gitlab-time-tracker'" >>~/.bash_rc
119+
```
120+
121+
Now you can simply write `gtt` instead of the bulky Docker command before. Try it out: `gtt --help`
122+
123+
**Note:** If you want to save reports via the `--file` parameter, make sure to save them in `/root` or another
124+
mounted directory that you have access to on your host machine. Take a look at the [Docker documentation](https://docs.docker.com/engine/tutorials/dockervolumes/) about how Docker handles data and volumes.
125+
77126
## commands
78127

79128
### I) configuration

0 commit comments

Comments
 (0)