-
Notifications
You must be signed in to change notification settings - Fork 56
/
Dockerfile
89 lines (74 loc) · 3.15 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
FROM ubuntu:12.04
ENV MYSQLTMPROOT temprootpass
# Run upgrades
RUN echo deb http://us.archive.ubuntu.com/ubuntu/ precise universe multiverse >> /etc/apt/sources.list;\
echo deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe >> /etc/apt/sources.list;\
echo deb http://security.ubuntu.com/ubuntu precise-security main restricted universe >> /etc/apt/sources.list;\
echo udev hold | dpkg --set-selections;\
echo initscripts hold | dpkg --set-selections;\
echo upstart hold | dpkg --set-selections;\
apt-get update;\
apt-get -y upgrade
# Install dependencies
RUN apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev sudo python python-docutils python-software-properties nginx logrotate sendmail
# Install Git
RUN add-apt-repository -y ppa:git-core/ppa;\
apt-get update;\
apt-get -y install git
# Install Ruby
RUN mkdir /tmp/ruby;\
cd /tmp/ruby;\
curl ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | tar xz;\
cd ruby-2.0.0-p247;\
chmod +x configure;\
./configure --disable-install-rdoc;\
make;\
make install;\
gem install bundler --no-ri --no-rdoc
# Create Git user
RUN adduser --disabled-login --gecos 'GitLab' git
# Install GitLab Shell
RUN cd /home/git;\
su git -c "git clone https://github.com/gitlabhq/gitlab-shell.git -b v1.8.0";\
cd gitlab-shell;\
su git -c "cp config.yml.example config.yml";\
sed -i -e 's/localhost/127.0.0.1/g' config.yml;\
su git -c "./bin/install"
# Install MySQL
RUN echo mysql-server mysql-server/root_password password $MYSQLTMPROOT | debconf-set-selections;\
echo mysql-server mysql-server/root_password_again password $MYSQLTMPROOT | debconf-set-selections;\
apt-get install -y mysql-server mysql-client libmysqlclient-dev
# Install GitLab
RUN cd /home/git;\
su git -c "git clone https://github.com/gitlabhq/gitlabhq.git -b 6-4-stable gitlab"
# Misc configuration stuff
RUN cd /home/git/gitlab;\
chown -R git tmp/;\
chown -R git log/;\
chmod -R u+rwX log/;\
chmod -R u+rwX tmp/;\
su git -c "mkdir /home/git/gitlab-satellites";\
su git -c "mkdir tmp/pids/";\
su git -c "mkdir tmp/sockets/";\
chmod -R u+rwX tmp/pids/;\
chmod -R u+rwX tmp/sockets/;\
su git -c "mkdir public/uploads";\
chmod -R u+rwX public/uploads;\
su git -c "cp config/unicorn.rb.example config/unicorn.rb";\
su git -c "cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb";\
su git -c "git config --global user.name 'GitLab'";\
su git -c "git config --global user.email 'gitlab@localhost'";\
su git -c "git config --global core.autocrlf input"
RUN cd /home/git/gitlab;\
su git -c "bundle install --deployment --without development test postgres aws"
# Install init scripts
RUN cd /home/git/gitlab;\
cp lib/support/init.d/gitlab /etc/init.d/gitlab;\
update-rc.d gitlab defaults 21;\
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
EXPOSE 80
EXPOSE 22
ADD . /srv/gitlab
RUN chmod +x /srv/gitlab/start.sh;\
chmod +x /srv/gitlab/firstrun.sh
CMD ["/srv/gitlab/start.sh"]