GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
mark.george
/
dockerfiles
Browse code
Minor tweaks to GitBucket
master
1 parent
896d1fe
commit
7babd024159e7c3ee757f6ab3bc9e820319f989a
Mark George
authored
on 4 Mar 2022
Patch
Showing
1 changed file
gitbucket.dockerfile
Ignore Space
Show notes
View
gitbucket.dockerfile
# A minimal GitBucket. # # Volumes: # /gitbucket_data - GitBucket persistent data. Precreate to prevent Docker creating with root privs. # /opt/gitbucket - location of gitbucket.war (parent directory). Plugins should reside in a 'plugins' directory inside this directory. # # Build with: # > docker build . # # Run with: # > docker run --detach --publish 8080:8080 --volume data_location:/gitbucket_data --volume war_location:/opt/gitbucket --env GITBUCKET_PREFIX=/prefix # # Configuration changes can be made via environment variables, so override by supplying --env parameters (or an env file). # start with the Alpine Adoptium base FROM eclipse-temurin:17-alpine as jre-build # Java module dependencies found by unzipping WAR and running: # jdeps --class-path 'WEB-INF/classes,WEB-INF/lib/*,.' -recursive -summary . # jdeps currently requires objc from binutils RUN apk add --no-cache binutils # generate a minimal JRE that includes only the necessary modules RUN $JAVA_HOME/bin/jlink \ --add-modules java.base,java.desktop,java.instrument,java.logging,java.management,java.naming,java.security.jgss,java.sql,java.xml \ --strip-debug \ --no-man-pages \ --no-header-files \ --compress=2 \ --output /jre FROM alpine:3.15 ### COPY GENERATED JRE ### ENV JAVA_HOME=/opt/java/openjdk ENV PATH "${JAVA_HOME}/bin:${PATH}" COPY --from=jre-build /jre $JAVA_HOME ### INSTALL DEPENDENCIES ### # font support needed for generating avatar icons, curl needed for healthcheck, graphviz needed by plantuml plugin RUN apk add --no-cache graphviz fontconfig ttf-opensans curl RUN \ addgroup gitbucket && \ adduser --disabled-password -G gitbucket gitbucket && \ mkdir /home/gitbucket/tmp USER gitbucket # These are variables that GitBucket looks for. Override when starting container (--env on Docker) if needed. # See: https://github.com/gitbucket/gitbucket/wiki/Basic-configurations ENV \ GITBUCKET_HOME="/gitbucket/gitbucket_data" \ GITBUCKET_PORT=8080 \ GITBUCKET_PREFIX="" \ GITBUCKET_PLUGINDIR="/opt/gitbucket/plugins" \ GITBUCKET_TEMPDIR="/home/gitbucket/tmp" EXPOSE 8080/tcp HEALTHCHECK --interval=5m --timeout=5s CMD curl --fail http://localhost:8080/ || exit 1 CMD ["/opt/java/openjdk/bin/java", "-Xms128m", "-Xms512m", "-jar", "/opt/gitbucket/gitbucket.war"]
# A minimal GitBucket. # # Volumes: # /gitbucket - GitBucket persistent data. Precreate to prevent Docker creating with root privs. # /opt/gitbucket - location of gitbucket.war (parent directory) # # Build with: # >docker build . # # Run with: # >docker run --detach --publish 8080:8080 --volume data_location:/gitbucket --volume war_location:/opt/gitbucket -e GITBUCKET_PREFIX=/prefix # # Configuration changes can be made via environment variables, so override by supplying -e parameters (or an env file). # start with the Alpine Adoptium base FROM eclipse-temurin:11-alpine as jre-build # Java module dependencies found by unzipping WAR and running: # jdeps --class-path 'WEB-INF/classes,WEB-INF/lib/*,.' -recursive -summary . # generate a minimal JRE that includes only the necessary modules RUN $JAVA_HOME/bin/jlink \ --add-modules java.base,java.desktop,java.instrument,java.logging,java.management,java.naming,java.security.jgss,java.sql,java.xml \ --strip-debug \ --no-man-pages \ --no-header-files \ --compress=2 \ --output /jre FROM alpine:3.15 ### COPY GENERATED JRE ### ENV JAVA_HOME=/opt/java/openjdk ENV PATH "${JAVA_HOME}/bin:${PATH}" COPY --from=jre-build /jre $JAVA_HOME ### INSTALL DEPENDENCIES ### # font support needed for generating avatar icons, curl needed for healthcheck RUN apk add --no-cache fontconfig ttf-opensans curl ### DEPLOY APPLICATION ### #RUN mkdir /opt/gitbucket #COPY gitbucket.war /opt/gitbucket RUN addgroup gitbucket && adduser -D -G gitbucket gitbucket USER gitbucket ENV \ GITBUCKET_HOME=/gitbucket/gitbucket-data \ GITBUCKET_PORT=8080 \ GITBUCKET_PREFIX="" \ GITBUCKET_PLUGINDIR="" \ GITBUCKET_TMPDIR="" EXPOSE 8080/tcp HEALTHCHECK --interval=5m --timeout=5s CMD curl --fail http://localhost:8080/ || exit 1 CMD ["/opt/java/openjdk/bin/java", "-Xms128m", "-Xms512m", "-jar", "/opt/gitbucket/gitbucket.war"]
Show line notes below