1
0

Added arguments for GitBucket's version and the JRE RAM, Exposed HTTPS port, Improved the readme

Update Dockerfile, docker-compose.yml, and readme.md
This commit is contained in:
Herwin Bozet (NibblePoker) 2021-12-13 13:52:25 +01:00
parent 18db8c1d07
commit cd9560f2db
3 changed files with 48 additions and 24 deletions

View File

@ -1,26 +1,25 @@
FROM eclipse-temurin:latest FROM eclipse-temurin:latest
# Preparing GitBucket's folder and installing packages. # 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. # Downloading GitBucket
# RUN apt-get -y install bash ARG GITBUCKET_DESIRED_VERSION=4.37.0
ADD https://github.com/gitbucket/gitbucket/releases/download/$GITBUCKET_DESIRED_VERSION/gitbucket.war /gitbucket/gitbucket.war
# 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
# Setting up required GitBucket's environment variables # Setting up required GitBucket's environment variables
ENV GITBUCKET_HOME /gitbucket/gitbucket_data 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 8080
EXPOSE 8443 EXPOSE 8443
EXPOSE 29418
# Running the application # Running the application
# You can remove the "-Xms128m" and "-Xmx256m" arguments if you need to support more than a couple concurent users.
WORKDIR /gitbucket 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

View File

@ -6,14 +6,19 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args:
- GITBUCKET_DESIRED_VERSION=4.37.0
ports: ports:
- 8080:8080 # HTTP - 8080:8080 # HTTP
- 8443:8443 # HTTPS (Optionnal) - 8443:8443 # HTTPS (Optionnal)
- 29418:29418 # SSH (Optionnal, disabled by default) - 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: volumes:
- ./data:/gitbucket/gitbucket_data - ./data:/gitbucket/gitbucket_data
restart: unless-stopped 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

View File

@ -3,20 +3,40 @@ A simple docker-compose file that can be used to create a *GitBucket* container
## Requirements ## Requirements
__CPU Architecture:__ ARM64 <sub><sup>(Use the [official image](https://hub.docker.com/r/gitbucket/gitbucket/) for AMD64)</sup></sub><br> __CPU Architecture:__ ARM64 <sub><sup>(Use the [official image](https://hub.docker.com/r/gitbucket/gitbucket/) for AMD64)</sup></sub><br>
__RAM:__ Between 256 and 512 MiB __RAM:__ Between 256 and 512 MiB<br>
__HDD:__ Around 200 MiB
## Remarks ## Remarks
This container is not intended to be used with an external database and forces GitBucket to use a local DB.<br> This container is not intended to be used with an external database and forces GitBucket to use a local DB.<br>
However, it should be relatively easy to use an external one if you change the `DATABASE_URL` environment variable. 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/).<br> 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).
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 repository has only been tested with on GitBucket *v4.36.0* to *v4.37.0* !
## Building ## 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 ## Configuration
TODO.
### Dockerfile <sub><sup>(Not recommended)</sup></sub>
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 ## License
[Unlicensed](LICENSE) [Unlicensed](LICENSE)