Skip to content

Instantly share code, notes, and snippets.

@ayufan
Created March 5, 2020 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayufan/27053eca04c450c4d4f7511fbf964e95 to your computer and use it in GitHub Desktop.
Save ayufan/27053eca04c450c4d4f7511fbf964e95 to your computer and use it in GitHub Desktop.
Run Omnibus GitLab
#!/bin/bash
set -ex
IMAGE="${1:-gitlab/gitlab-ce:latest}"
shift
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
trap "rm -rf $tmp_dir" EXIT
for patch; do
cp "$patch" "$tmp_dir/"
done
cat <<EOF > $tmp_dir/Dockerfile
FROM $IMAGE
RUN apt-get update -y -qqq && apt-get install -y patch
ADD . /patches
RUN find /patches -name '*.patch'
RUN find /patches -name '*.patch' | \
xargs -n1 patch --verbose -p1 -d /opt/gitlab/embedded/service/gitlab-rails/ "{}"
EOF
docker build -t "run-gitlab-omnibus" "$tmp_dir/"
docker rm -f gitlab || true
docker run -it \
--privileged \
--hostname gitlab.example.com \
--publish 40443:443 --publish 4080:80 --publish 4022:22 \
--name gitlab \
--restart no \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
"run-gitlab-omnibus"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment