From 2154c829cb825a250b798e9eb2c141e9e2614f8a Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 6 Sep 2018 14:13:23 +0200 Subject: install gems, gitlab-shell, gitlab-workhorse, gitlab-pages install build deps late so we can install then and remove them in one RUN in future. --- gitlab/Dockerfile | 64 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 21 deletions(-) (limited to 'gitlab/Dockerfile') diff --git a/gitlab/Dockerfile b/gitlab/Dockerfile index 17f2ee2..7f949b7 100644 --- a/gitlab/Dockerfile +++ b/gitlab/Dockerfile @@ -1,47 +1,32 @@ FROM alpine:3.8 ENV GITLAB_BRANCH 11-3-stable +ENV GIT_HOME=/home/git RUN apk add -U \ - build-base \ - zlib-dev \ - yaml-dev \ - libressl-dev \ - gdbm-dev \ - re2-dev \ - readline-dev \ - ncurses-dev \ - libffi-dev \ - curl-dev \ openssh-server \ - libxml2-dev \ - libxslt-dev \ - icu-dev \ logrotate \ rsync \ - py-docutils \ - cmake \ ruby=~2.5 \ yarn \ nodejs \ sudo \ - git \ - go + git # create git user and config git RUN addgroup -S git \ - && adduser -S -D -h /var/lib/git -s /bin/sh -G git -g git git \ + && adduser -S -D -h $GIT_HOME -s /bin/sh -G git -g git git \ && sudo -u git -H git config --global core.autocrlf input \ && sudo -u git -H git config --global gc.auto 0 \ && sudo -u git -H git config --global repack.writeBitmaps true \ && sudo -u git -H git config --global receive.advertisePushOptions true # clone gitlab repo -RUN cd /var/lib/git \ +RUN cd $GIT_HOME \ && sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b $GITLAB_BRANCH gitlab # fix permissions -RUN cd /var/lib/git/gitlab \ +RUN cd $GIT_HOME/gitlab \ && chown -R git log/ tmp/ \ && chmod -R u+rwX,go-w log/ \ && chmod -R u+rwX tmp/ \ @@ -55,7 +40,7 @@ RUN cd /var/lib/git/gitlab \ # the following files may need to be edited for our config -RUN cd /var/lib/git/gitlab \ +RUN cd $GIT_HOME/gitlab \ && install -o git -g git config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb \ && install -o git -g git config/gitlab.yml.example config/gitlab.yml \ && install -o git -g git -m0600 config/secrets.yml.example config/secrets.yml \ @@ -63,8 +48,45 @@ RUN cd /var/lib/git/gitlab \ && install -o git -g git config/unicorn.rb.example config/unicorn.rb \ && install -o git -g git -m640 config/database.yml.postgresql config/database.yml +# install Gems +RUN cd $GIT_HOME/gitlab \ + && apk add --virtual .build-deps \ + ruby-dev \ + ruby-bundler \ + postgresql-dev \ + build-base \ + zlib-dev \ + yaml-dev \ + libressl-dev \ + gdbm-dev \ + re2-dev \ + readline-dev \ + ncurses-dev \ + libffi-dev \ + curl-dev \ + libxml2-dev \ + libxslt-dev \ + icu-dev \ + py-docutils \ + linux-headers \ + cmake \ + go \ + && sudo -u git -H bundle install -j$(nproc) --deployment --without development test mysql aws kerberos +# gitlab shell +RUN cd $GIT_HOME/gitlab \ + sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true +# gitlab-workhorse +RUN cd $GIT_HOME/gitlab \ + sudo -u git -H bundle exec rake "gitlab:workhorse:install[$GIT_HOME/gitlab-workhorse]" RAILS_ENV=production + +# gitlab-pages +RUN cd $GIT_HOME \ + && sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git \ + && cd gitlab-pages \ + && sudo -u git -H git checkout v$(cat $GIT_HOME/gitlab/GITLAB_PAGES_VERSION) \ + && sudo -u git -H make -- cgit v1.2.3