Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

int128/gitbucket-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitBucket on Docker and Kubernetes test

A GitBucket Docker image and Kubernetes Helm chart.

This repository is automatically updated to the latest GitBucket by CircleCI.

Docker

docker run -p 8080:8080 -p 29418:29418 int128/gitbucket

You can save your GitBucket data to ./gitbucket persistently as follows:

mkdir -p /data/gitbucket
chown -R 1000:1000 /data/gitbucket
docker run -p 8080:8080 -p 29418:29418 -v /data/gitbucket:/var/gitbucket int128/gitbucket

This image runs as gitbucket user (uid=1000, gid=1000), not root for security reason.

This image exposes the following ports:

  • 8080 - Web service
  • 29418 - SSH access to git repository

Environment variables

You can set the following environment variables:

Name Value
GITBUCKET_HOME Directory to store data. Defaults to /var/gitbucket.
GITBUCKET_BASE_URL Base URL. This may be required if container is behind a reverse proxy.
GITBUCKET_DB_URL External database URL. Defaults to H2.
GITBUCKET_DB_USER External database user.
GITBUCKET_DB_PASSWORD External database password.
GITBUCKET_OPTS GitBucket command line options.
JAVA_OPTS JVM options. Defaults to options setting JVM heap by container memory limit. See Dockerfile for more.

Kubernetes Helm

⚠️ NOTE: Currently Helm chart is not published due to CI issue. Please build it yourself instead

helm repo add int128.github.io https://int128.github.io/helm-charts
helm repo update
helm install int128.github.io/gitbucket

The Helm chart considers the followings:

  • Mount the persistent volume to /var/gitbucket.
  • Fix owner of /var/gitbucket by the init container.
  • Set readiness probe and liveness probe with access to :8080/signin. It should return 200.

Values

You can set the following values:

Name Value
gitbucket.options GitBucket command line options.
javavm.options JVM options. Defaults to setting JVM heap by the memory limit. See Dockerfile for more.
externalDatabase.url The external database URL. Defaults to H2.
externalDatabase.user The external database user.
externalDatabase.password The external database password.
externalDatabase.existingSecret Name of an existing secret to be used for the database password.
externalDatabase.existingSecretKey The key for the database password in the existing secret.
persistentVolume.existingClaim Name of an existing Persistent Volume Claim.
persistentVolume.size Size of a Persistent Volume Claim for dynamic provisioning. Defaults to 10Gi.
resources.limits.memory Memory limit. Defaults to 1Gi.
resources.requests.memory Memory request. Defaults to 1Gi.
ingress.enabled If true, an ingress is be created.
ingress.hosts A list of hosts for the ingress.
annotations Additional annotations. Defaults to {}
labels Additional labels. Defaults to {}
environment Additional environment variables. Defaults to {}
enableServiceLinks Indicates whether information about services should be injected into pod's environment variables. Defaults to true
useDefaultServiceAccount Indicates whether the default ServiceAccount should be used. Otherwise a ServiceAccount with the name gitbucket.fullname will be created. Defaults to true
runAsNonRoot Require that the container will run with a user with any UID other than 0. Defaults to false
chownDataDirectoryInInitContainer Enable initContainer that will change ownership of data directory to 1000:1000. Defaults to true

External database

You can create a database and user for the GitBucket as follows:

# PostgreSQL
CREATE DATABASE gitbucket;
CREATE USER gitbucket PASSWORD 'gitbucket';
GRANT ALL PRIVILEGES ON DATABASE gitbucket TO gitbucket;

# MySQL
CREATE DATABASE gitbucket;
GRANT ALL PRIVILEGES ON gitbucket.* to gitbucket@'%' identified by 'gitbucket';
FLUSH PRIVILEGES; 

Contributions

This is an open source software licensed under Apache License 2.0. Feel free to open issues and pull requests.