mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-18 13:58:25 +00:00
speed up container startup by compiling assets at image build time
Closes #461 Closes #100 Refer #153
This commit is contained in:
parent
fa9fac0fdf
commit
823a2e6289
@ -2,6 +2,9 @@
|
||||
|
||||
This file only reflects the changes that are made in the the docker image. Please refer to the upstream GitLab [CHANGELOG](https://github.com/gitlabhq/gitlabhq/blob/master/CHANGELOG) for the list of changes in GitLab.
|
||||
|
||||
**latest**
|
||||
- speed up container startup by compiling assets at image build time
|
||||
|
||||
**8.0.5**
|
||||
- gitlab: upgrade to CE v.8.0.5
|
||||
|
||||
|
||||
@ -75,30 +75,6 @@ sudo -HEu ${GITLAB_USER} cp config/unicorn.rb.example config/unicorn.rb
|
||||
sudo -HEu ${GITLAB_USER} cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
|
||||
sudo -HEu ${GITLAB_USER} cp config/initializers/smtp_settings.rb.sample config/initializers/smtp_settings.rb
|
||||
|
||||
# symlink log -> ${GITLAB_LOG_DIR}/gitlab
|
||||
rm -rf log
|
||||
ln -sf ${GITLAB_LOG_DIR}/gitlab log
|
||||
|
||||
# create required tmp directories
|
||||
sudo -HEu ${GITLAB_USER} mkdir -p tmp/pids/ tmp/sockets/
|
||||
chmod -R u+rwX tmp
|
||||
|
||||
# create symlink to assets in tmp/cache
|
||||
rm -rf tmp/cache
|
||||
sudo -HEu ${GITLAB_USER} ln -s ${GITLAB_DATA_DIR}/tmp/cache tmp/cache
|
||||
|
||||
# create symlink to assets in public/assets
|
||||
rm -rf public/assets
|
||||
sudo -HEu ${GITLAB_USER} ln -s ${GITLAB_DATA_DIR}/tmp/public/assets public/assets
|
||||
|
||||
# create symlink to uploads directory
|
||||
rm -rf public/uploads
|
||||
sudo -HEu ${GITLAB_USER} ln -s ${GITLAB_DATA_DIR}/uploads public/uploads
|
||||
|
||||
# create symlink to .secret in GITLAB_DATA_DIR
|
||||
rm -rf .secret
|
||||
sudo -HEu ${GITLAB_USER} ln -sf ${GITLAB_DATA_DIR}/.secret
|
||||
|
||||
# install gems required by gitlab, use local cache if available
|
||||
if [[ -d ${GEM_CACHE_DIR} ]]; then
|
||||
mv ${GEM_CACHE_DIR} vendor/
|
||||
@ -109,9 +85,32 @@ sudo -HEu ${GITLAB_USER} bundle install -j$(nproc) --deployment --without develo
|
||||
# make sure everything in ${GITLAB_HOME} is owned by the git user
|
||||
chown -R ${GITLAB_USER}:${GITLAB_USER} ${GITLAB_HOME}/
|
||||
|
||||
# compile assets
|
||||
echo "Compiling assets. Please be patient, this could take a while..."
|
||||
sudo -HEu ${GITLAB_USER} bundle exec rake assets:clean assets:precompile >/dev/null 2>&1
|
||||
|
||||
# install schedules cronjob
|
||||
sudo -HEu ${GITLAB_USER} bundle exec whenever -w
|
||||
|
||||
# symlink log -> ${GITLAB_LOG_DIR}/gitlab
|
||||
rm -rf log
|
||||
ln -sf ${GITLAB_LOG_DIR}/gitlab log
|
||||
|
||||
# create required tmp directories
|
||||
sudo -HEu ${GITLAB_USER} mkdir -p tmp/pids/ tmp/sockets/
|
||||
chmod -R u+rwX tmp
|
||||
|
||||
# create symlink to uploads directory
|
||||
rm -rf public/uploads
|
||||
sudo -HEu ${GITLAB_USER} ln -s ${GITLAB_DATA_DIR}/uploads public/uploads
|
||||
|
||||
# create symlink to .secret in GITLAB_DATA_DIR
|
||||
rm -rf .secret
|
||||
sudo -HEu ${GITLAB_USER} ln -sf ${GITLAB_DATA_DIR}/.secret
|
||||
|
||||
# remove auto generated config/secrets.yml
|
||||
rm -rf config/secrets.yml
|
||||
|
||||
# install gitlab bootscript
|
||||
cp lib/support/init.d/gitlab /etc/init.d/gitlab
|
||||
chmod +x /etc/init.d/gitlab
|
||||
|
||||
@ -836,9 +836,6 @@ chown ${GITLAB_USER}:${GITLAB_USER} ${GITLAB_BUILDS_DIR}
|
||||
rm -rf builds
|
||||
ln -sf ${GITLAB_BUILDS_DIR} builds
|
||||
|
||||
# remove old cache directory (remove this line after a few releases)
|
||||
rm -rf ${GITLAB_DATA_DIR}/cache
|
||||
|
||||
# create the backups directory
|
||||
mkdir -p ${GITLAB_BACKUP_DIR}
|
||||
chown ${GITLAB_USER}:${GITLAB_USER} ${GITLAB_BACKUP_DIR}
|
||||
@ -899,8 +896,8 @@ appInit () {
|
||||
|
||||
# migrate database and compile the assets if the gitlab version or relative_url has changed.
|
||||
CACHE_VERSION=
|
||||
[[ -f tmp/cache/VERSION ]] && CACHE_VERSION=$(cat tmp/cache/VERSION)
|
||||
[[ -f tmp/cache/GITLAB_RELATIVE_URL_ROOT ]] && CACHE_GITLAB_RELATIVE_URL_ROOT=$(cat tmp/cache/GITLAB_RELATIVE_URL_ROOT)
|
||||
[[ -f ${GITLAB_DATA_DIR}/tmp/VERSION ]] && CACHE_VERSION=$(cat ${GITLAB_DATA_DIR}/tmp/VERSION)
|
||||
[[ -f ${GITLAB_DATA_DIR}/tmp/GITLAB_RELATIVE_URL_ROOT ]] && CACHE_GITLAB_RELATIVE_URL_ROOT=$(cat ${GITLAB_DATA_DIR}/tmp/GITLAB_RELATIVE_URL_ROOT)
|
||||
if [[ ${GITLAB_VERSION} != ${CACHE_VERSION} || ${GITLAB_RELATIVE_URL_ROOT} != ${CACHE_GITLAB_RELATIVE_URL_ROOT} ]]; then
|
||||
echo "Migrating database..."
|
||||
sudo -HEu ${GITLAB_USER} bundle exec rake db:migrate >/dev/null
|
||||
@ -908,17 +905,13 @@ appInit () {
|
||||
# recreate the tmp directory
|
||||
rm -rf ${GITLAB_DATA_DIR}/tmp
|
||||
sudo -HEu ${GITLAB_USER} mkdir -p ${GITLAB_DATA_DIR}/tmp/
|
||||
chmod -R u+rwX ${GITLAB_DATA_DIR}/tmp/
|
||||
|
||||
# create the tmp/cache and tmp/public/assets directory
|
||||
sudo -HEu ${GITLAB_USER} mkdir -p ${GITLAB_DATA_DIR}/tmp/cache/
|
||||
sudo -HEu ${GITLAB_USER} mkdir -p ${GITLAB_DATA_DIR}/tmp/public/assets/
|
||||
# clear the cache
|
||||
sudo -HEu ${GITLAB_USER} bundle exec rake cache:clear >/dev/null 2>&1
|
||||
|
||||
echo "Compiling assets. Please be patient, this could take a while..."
|
||||
sudo -HEu ${GITLAB_USER} bundle exec rake assets:clean assets:precompile cache:clear >/dev/null 2>&1
|
||||
sudo -HEu ${GITLAB_USER} touch tmp/cache/VERSION
|
||||
sudo -HEu ${GITLAB_USER} echo "${GITLAB_VERSION}" > tmp/cache/VERSION
|
||||
sudo -HEu ${GITLAB_USER} echo "${GITLAB_RELATIVE_URL_ROOT}" > tmp/cache/GITLAB_RELATIVE_URL_ROOT
|
||||
# update VERSION information
|
||||
sudo -HEu ${GITLAB_USER} echo "${GITLAB_VERSION}" > ${GITLAB_DATA_DIR}/tmp/VERSION
|
||||
sudo -HEu ${GITLAB_USER} echo "${GITLAB_RELATIVE_URL_ROOT}" > ${GITLAB_DATA_DIR}/tmp/GITLAB_RELATIVE_URL_ROOT
|
||||
fi
|
||||
|
||||
# remove stale unicorn and sidekiq pid's if they exist.
|
||||
@ -983,10 +976,6 @@ appSanitize () {
|
||||
chmod 0750 ${GITLAB_DATA_DIR}/uploads/
|
||||
chown ${GITLAB_USER}:${GITLAB_USER} ${GITLAB_DATA_DIR}/uploads/
|
||||
|
||||
echo "Checking tmp directory permissions..."
|
||||
chmod -R u+rwX ${GITLAB_DATA_DIR}/tmp/
|
||||
chown ${GITLAB_USER}:${GITLAB_USER} -R ${GITLAB_DATA_DIR}/tmp/
|
||||
|
||||
echo "Creating gitlab-shell hooks..."
|
||||
sudo -HEu ${GITLAB_USER} ${GITLAB_SHELL_INSTALL_DIR}/bin/create-hooks
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user