Public Repository

Last pushed: 4 years ago
Short Description
Gitlab 6
Full Description

GitLab 6.0

#

VERSION 0.1

FROM ubuntu:quantal

RUN apt-get update -y && apt-get upgrade -y

Install the required packages:

RUN sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev postgresql-9.1 libpq-dev expect vim python python-docutils nginx
RUN sudo update-alternatives --set editor /usr/bin/vim.basic

Install Postfix

RUN bash -c 'debconf-set-selections <<< "postfix postfix/mailname string www.example.com"'
RUN bash -c 'debconf-set-selections <<< "postfix postfix/main_mailer_type string Internet Site"'
RUN sudo apt-get install -y postfix

Install Ruby

RUN mkdir /tmp/ruby && cd /tmp/ruby && curl --progress http://mirrors.ibiblio.org/ruby/ruby-2.0.0-p247.tar.gz | tar xz && cd ruby-2.0.0-p247 && ./configure && make && sudo make install && sudo gem install bundler --no-ri --no-rdoc

Install Gitlab User

RUN sudo adduser --disabled-login --gecos 'GitLab' git

Install Gitlab Shell

RUN cd /home/git && sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git && cd /home/git/gitlab-shell && sudo -u git -H git checkout v1.7.0 && sudo -u git -H cp config.yml.example config.yml && sudo -u git -H ./bin/install

Configure User/Database Ownership with PostgreSQL

RUN sudo service postgresql start && sudo -u postgres psql -d template1 -c "CREATE USER git WITH PASSWORD 'git';" && sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;"

Install Gitlab

RUN cd /home/git && sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab && cd /home/git/gitlab && sudo -u git -H git checkout 6-0-stable && cp config/gitlab.yml.example config/gitlab.yml

Make sure GitLab can write to the log/ and tmp/ directories

RUN sudo chown -R git /home/git/gitlab/log/ && sudo chown -R git /home/git/gitlab/tmp/ && sudo chmod -R u+rwX /home/git/gitlab/log/ && sudo chmod -R u+rwX /home/git/gitlab/tmp/

Create directory for satellites

RUN sudo -u git -H mkdir /home/git/gitlab-satellites

Create directories for sockets/pids and make sure GitLab can write to them

RUN sudo -u git -H mkdir /home/git/gitlab/tmp/pids/ && sudo -u git -H mkdir /home/git/gitlab/tmp/sockets/ && sudo chmod -R u+rwX /home/git/gitlab/tmp/pids/ && sudo chmod -R u+rwX /home/git/gitlab/tmp/sockets/

Create public/uploads directory otherwise backup will fail

RUN sudo -u git -H mkdir /home/git/gitlab/public/uploads && sudo chmod -R u+rwX /home/git/gitlab/public/uploads

Copy the example Unicorn config

RUN cd /home/git/gitlab && sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb

Configure Git global settings for git user, useful when editing via web

Edit user.email according to what is set in gitlab.yml

RUN sudo -u git -H git config --global user.name "GitLab" && sudo -u git -H git config --global user.email "gitlab@localhost" && sudo -u git -H git config --global core.autocrlf input

Set up DB

RUN cd /home/git/gitlab && sudo -u git -H cp config/database.yml.postgresql config/database.yml && sudo -u git -H chmod o-rwx config/database.yml && sed -i -e '0,/password:/s//password: git/' config/database.yml

Install Gems

RUN cd /home/git/gitlab && sudo gem install charlock_holmes --version '0.6.9.4' && sudo -u git -H bundle install --deployment --without development test mysql aws

Initialize database

RUN cd /home/git/gitlab && sudo service postgresql start && sudo service redis-server start && expect -c 'spawn sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production; expect "yes/no"; send "yes\r"; expect eof;'

Install init script

RUN cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab
RUN chmod +x /etc/init.d/gitlab
RUN sudo update-rc.d gitlab defaults 21

Configure nginx

RUN cp /home/git/gitlab/lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab && ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab && rm /etc/nginx/sites-enabled/default

EXPOSE 80

WORKDIR /home/git/gitlab

Check Gitlab is running

CMD sudo service postgresql start && sudo service redis-server start && sudo service gitlab start && sudo service nginx start && sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production && sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production && sh -c "while true; do sleep 60; done"

Docker Pull Command
Owner
johnjelinek