diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..8d33d2616 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +Gemfile.lock +Dockerfile +docker-compose.yml +*.gem +deploy diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..ddb37e4f7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM ruby:2.5 + +WORKDIR /app + +COPY . ./ +RUN bundle install + +CMD ["bin/console"] diff --git a/README.md b/README.md index 9a73a084b..0e87be363 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,64 @@ For more information, refer to [website](http://narkoz.github.io/gitlab). ## Development +### With a dockerized Gitlab instance + +```shell +docker-compose up -d gitlab # Will start the gitlab instance in the background (approx. 3 minutes) +``` + +After a while, your Gitlab instance will be accessible on http://localhost:3000. + +Once you have set your new root password, you can login with the root user. + +You can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens + +Once you have your token, set the variables to the correct values in the `docker.env` file. + +Then, launch the tool: + +```shell +docker-compose run app +``` + +```ruby +Gitlab.users +=> [#1, "name"=>"Administrator", "username"=>"root", ...] +``` + +To launch the specs, + +```shell +docker-compose run app rake spec +``` + +#### Want to use Gitlab Enterprise? + +Just change the image from `gitlab/gitlab-ce:latest` to `gitlab/gitlab-ee:latest` in the `docker-compose.yml` file. + +### With an external Gitlab instance + +First, set the variables to the correct values in the `docker.env` file. + +Then, launch the tool: + +```shell +docker-compose run app +``` + +```ruby +Gitlab.users +=> [#1, "name"=>"Administrator", "username"=>"root", ...] +``` + +To launch the specs, + +```shell +docker-compose run app rake spec +``` + +### Without Docker + After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..a71fa5e15 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +# For more information, see https://docs.gitlab.com/omnibus/docker/README.html#install-gitlab-using-docker-compose +version: '3' +services: + app: + build: . + volumes: + - ./:/app + env_file: docker.env + + gitlab: + image: 'gitlab/gitlab-ce:latest' + restart: always + hostname: 'gitlab.example.com' + environment: + GITLAB_OMNIBUS_CONFIG: | + external_url 'http://gitlab.example.com:3000' + # Add any other gitlab.rb configuration here, each on its own line + ports: + - 3000:3000 diff --git a/docker.env b/docker.env new file mode 100644 index 000000000..0f2a7c2fb --- /dev/null +++ b/docker.env @@ -0,0 +1,2 @@ +GITLAB_API_ENDPOINT=http://gitlab:3000/api/v4 +GITLAB_API_PRIVATE_TOKEN=j3CLYZMg_dsTPpCR2HWf