Skip to content

Commit a012111

Browse files
committed
Allow JVM options to be set via environment variable
Thanks go to Jacek Kowalski (jacekkow@0b247732408f877aabca3adf77381fc37776f43a)
1 parent e423a8f commit a012111

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ These instructions assume you are running Linux and you have already [installed
77

88
You can use the official [Gitblit Docker image](https://hub.docker.com/r/gitblit/gitblit).
99

10+
See the [Docker Hub Readme](hub-readme.md) for more detailed usage information.
11+
12+
1013
### Start a Gitblit instance
1114

1215

docker-entrypoint.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
#!/bin/sh
22
set -e
33

4+
5+
# allow JVM options to be set from outside
6+
if [ -z "$JAVA_OPTS" ] ; then
7+
JAVA_OPTS="-Xmx1024M"
8+
fi
9+
10+
411
gitblit_path=/opt/gitblit
5-
gitblit="java -server -Xmx1024M -Djava.awt.headless=true -cp ${gitblit_path}/gitblit.jar:${gitblit_path}/ext/* com.gitblit.GitBlitServer"
12+
gitblit="java -server $JAVA_OPTS -Djava.awt.headless=true -cp ${gitblit_path}/gitblit.jar:${gitblit_path}/ext/* com.gitblit.GitBlitServer"
613

714

815
# use gosu or su-exec to step down from root

hub-readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ gitblit-config /var/lib/docker/volumes/gitblit-config/_data local
9191
gitblit-repos /var/lib/docker/volumes/gitblit-repos/_data local
9292
```
9393

94+
It also makes updates easier. Simply provide the same named volumes to the new version of the container:
95+
96+
```console
97+
$ sudo docker pull gitblit/gitblit:rpc
98+
$ sudo docker stop gitblit
99+
$ sudo docker container rm gitblit
100+
$ sudo docker run -d --name gitblit -v gitblit-data:/var/opt/gitblit -p 8443:8443 -p 29418:29418 gitblit/gitblit:rpc
101+
```
102+
103+
Updating with anonymous volumes (you didn't provide a name for) requires you to either find out the volume id from the current running container and reusing that id for the new container, or to use the `--volumes-from` parameter, which requires the old container to still be around.
104+
94105

95106
### Temporary webapp data
96107

@@ -105,6 +116,19 @@ $ sudo docker run -d --name gitblit --tmpfs /var/opt/gitblit/temp -p 8443:8443 g
105116
```
106117

107118

119+
## Configuration
120+
121+
Configure the gitblit instance by adding your custom settings to the file `gitblit.properties` in the directory `/var/opt/gitbit/etc` in the container.
122+
123+
### JVM options
124+
125+
The gitblit server starts by default with the JVM option `-Xmx1024M`. You can override this by providing the `JAVA_OPTS` environment variable.
126+
127+
```console
128+
$ sudo docker run -d --name gitblit -e "JAVA_OPTS=-Xmx2048m" -p 8443:8443 gitblit/gitblit:rpc
129+
```
130+
131+
108132
## User and group id
109133

110134
Since image version 1.9.0-3 the gitblit process will be started as a non privileged user. The user id and group id used by the images are both `8117`.

0 commit comments

Comments
 (0)