forked from gitblit-org/gitblit-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (41 loc) · 2.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Basics
#
from ubuntu:latest
maintainer James Moger <[email protected]>
run apt-get update
run apt-get install -q -y git-core
# Install Java 7
run DEBIAN_FRONTEND=noninteractive apt-get install -q -y software-properties-common
run DEBIAN_FRONTEND=noninteractive apt-get install -q -y python-software-properties
run DEBIAN_FRONTEND=noninteractive apt-add-repository ppa:webupd8team/java -y
run apt-get update
run echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
run DEBIAN_FRONTEND=noninteractive apt-get install oracle-java7-installer -y
# Install Gitblit
run apt-get install -q -y curl
run curl -Lks https://github.com/gitblit/gitblit/releases/download/v1.3.2/gitblit-1.3.2.tar.gz -o /root/gitblit.tar.gz
run mkdir -p /opt/gitblit
run tar zxf /root/gitblit.tar.gz -C /opt/gitblit
run rm -f /root/gitblit.tar.gz
# Move the data files to a separate directory
run mkdir -p /opt/gitblit-data
run mv /opt/gitblit/data/* /opt/gitblit-data
run mv /opt/gitblit-data/gitblit.properties /opt/gitblit-data/default.properties
# Adjust the default Gitblit settings to bind to 80, 443, 9418, and allow RPC administration.
#
# Note: we are writing to a different file here because sed doesn't like to the same file it
# is streaming. This is why the original properties file was renamed earlier.
run sed -e "s/git\.daemonBindInterface\s=\slocalhost/git\.daemonBindInterface=/" \
-e "s/server\.httpsBindInterface\s=\slocalhost/server\.httpsBindInterface=/" \
-e "s/server\.httpBindInterface\s=\slocalhost/server\.httpBindInterface=/" \
-e "s/server\.httpsPort\s=\s8443/server\.httpsPort=443/" \
-e "s/server\.httpPort\s=\s0/server\.httpPort=80/" \
-e "s/web\.enableRpcManagement\s=\sfalse/web\.enableRpcManagement=true/" \
-e "s/web\.enableRpcAdministration\s=\sfalse/web.enableRpcAdministration=true/" \
/opt/gitblit-data/default.properties > /opt/gitblit-data/gitblit.properties
# Setup the Docker container environment and run Gitblit
workdir /opt/gitblit
expose 80
expose 443
expose 9418
cmd ["java", "-server", "-Xmx1024M", "-Djava.awt.headless=true", "-jar", "/opt/gitblit/gitblit.jar", "--baseFolder", "/opt/gitblit-data"]