From cd9560f2db1db6ee106a043c94c621a2f88e63a7 Mon Sep 17 00:00:00 2001 From: Herwin Date: Mon, 13 Dec 2021 13:52:25 +0100 Subject: [PATCH] Added arguments for GitBucket's version and the JRE RAM, Exposed HTTPS port, Improved the readme Update Dockerfile, docker-compose.yml, and readme.md --- Dockerfile | 25 ++++++++++++------------- docker-compose.yml | 17 +++++++++++------ readme.md | 30 +++++++++++++++++++++++++----- 3 files changed, 48 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index f965ed0..0c45318 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,25 @@ FROM eclipse-temurin:latest # Preparing GitBucket's folder and installing packages. -RUN mkdir /gitbucket && apt-get update +RUN mkdir /gitbucket && apt-get update && apt-get -y install git -# Comment if you don't need a shell access via bash in the container. -# RUN apt-get -y install bash - -# Uncomment if you are using a plugin that requires Git to be installed. -# RUN apt-get -y install git - -# Downloading gitBucket 4.36.2 -ADD https://github.com/gitbucket/gitbucket/releases/download/4.36.2/gitbucket.war /gitbucket/gitbucket.war +# Downloading GitBucket +ARG GITBUCKET_DESIRED_VERSION=4.37.0 +ADD https://github.com/gitbucket/gitbucket/releases/download/$GITBUCKET_DESIRED_VERSION/gitbucket.war /gitbucket/gitbucket.war # Setting up required GitBucket's environment variables ENV GITBUCKET_HOME /gitbucket/gitbucket_data -ENV DATABASE_URL jdbc:h2:/gitbucket/gitbucket_daya/data;MVCC=true +ENV DATABASE_URL jdbc:h2:/gitbucket/gitbucket_data/data;MVCC=true +#ENV JVM_RAM_MIN -Xms128m +#ENV JVM_RAM_MAX -Xmx256m +ENV JVM_RAM_MIN 128m +ENV JVM_RAM_MAX 256m -# Exposing HTTP and SSH ports +# Exposing HTTP, HTTPS and SSH ports EXPOSE 8080 EXPOSE 8443 +EXPOSE 29418 # Running the application -# You can remove the "-Xms128m" and "-Xmx256m" arguments if you need to support more than a couple concurent users. WORKDIR /gitbucket -CMD ["java", "-Xms128m", "-Xmx256m", "-jar", "/gitbucket/gitbucket.war"] +CMD java -Xms$JVM_RAM_MIN -Xmx$JVM_RAM_MAX -Dlog4j2.formatMsgNoLookups=true -jar /gitbucket/gitbucket.war diff --git a/docker-compose.yml b/docker-compose.yml index 0962044..254b679 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,14 +6,19 @@ services: build: context: . dockerfile: Dockerfile + args: + - GITBUCKET_DESIRED_VERSION=4.37.0 ports: - - 8080:8080 # HTTP - - 8443:8443 # HTTPS (Optionnal) + - 8080:8080 # HTTP + - 8443:8443 # HTTPS (Optionnal) - 29418:29418 # SSH (Optionnal, disabled by default) + environment: + # This environment variable should only be uncommented if you intend to use an external database and/or a different data folder. + # GITBUCKET_HOME: "/gitbucket/gitbucket_data" + # DATABASE_URL: "jdbc:h2:/gitbucket/gitbucket_data/data;MVCC=true" + # You can change the values of these two environment variables if want more RAM for the JVM and need to support more than a couple concurent users. + JVM_RAM_MIN: "128m" + JVM_RAM_MAX: "256m" volumes: - ./data:/gitbucket/gitbucket_data restart: unless-stopped - - # Both of these can be commented if you don't intend to use a shell in the container. - tty: true - stdin_open: true diff --git a/readme.md b/readme.md index 1f663aa..0032fbe 100644 --- a/readme.md +++ b/readme.md @@ -3,20 +3,40 @@ A simple docker-compose file that can be used to create a *GitBucket* container ## Requirements __CPU Architecture:__ ARM64 (Use the [official image](https://hub.docker.com/r/gitbucket/gitbucket/) for AMD64)
-__RAM:__ Between 256 and 512 MiB +__RAM:__ Between 256 and 512 MiB
+__HDD:__ Around 200 MiB ## Remarks This container is not intended to be used with an external database and forces GitBucket to use a local DB.
However, it should be relatively easy to use an external one if you change the `DATABASE_URL` environment variable. -This container also uses the Temurin OpenJDK distribution from [Adoptium](https://adoptium.net/).
-However, the `openjdk-11-jre-headless` and `openjdk-11-jdk-headless` packages from [bitnami/minideb](https://github.com/bitnami/minideb) can be used instead if you wish to use the latest version when building the container. +This container also uses the Temurin OpenJDK distribution from [Adoptium](https://adoptium.net/) and not the `openjdk-11-jre-headless` and `openjdk-11-jdk-headless` packages from [bitnami/minideb](https://github.com/bitnami/minideb). + +This repository has only been tested with on GitBucket *v4.36.0* to *v4.37.0* ! ## Building -In order to build this container, all you have to do is to clone this repository and run `docker-compose up`. + +### Docker +**TODO** + +### Docker-compose +1. Clone the repository +2. Configure the files according to the [Configuration](#configuration) section. +3. Run `docker-compose up` in the cloned repository's folder. ## Configuration -TODO. + +### Dockerfile (Not recommended) +You can remove the last part of the second instruction to prevent the installation of *Git* if you don't intend to use any extension that requires it to be installed. + +You can also edit the last `CMD` instruction to change the `-Xms128m` and `-Xmx256m` JVM arguments to more appropriate values if you need to support more than a couple concurent users and don't want to edit the [docker-compose file](docker-compose.yml) or you `docker build` command. + +### Docker-compose +You can change GitBucket version by changing the `GITBUCKET_DESIRED_VERSION` build argument to the desired version number. + +You can also uncomment and edit the `GITBUCKET_HOME` and `DATABASE_URL` environment variables if you intend to use an external database and/or data folder. + +Finally, you can change the `JVM_RAM_MIN` and `JVM_RAM_MAX` environment variables to change the amount of RAM allocated to the *JVM* if you need to support more than a couple concurent users. ## License [Unlicensed](LICENSE)