Created
March 5, 2020 17:52
-
-
Save ayufan/27053eca04c450c4d4f7511fbf964e95 to your computer and use it in GitHub Desktop.
Run Omnibus GitLab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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