Skip to content

Commit

Permalink
🐳 Add docker in Development
Browse files Browse the repository at this point in the history
  • Loading branch information
born4new committed Mar 24, 2018
1 parent 56f7f3a commit 8e38642
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
Gemfile.lock
Dockerfile
docker-compose.yml
*.gem
deploy
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ruby:2.5

WORKDIR /app

COPY . ./
RUN bundle install

CMD ["bin/console"]
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
=> [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>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
=> [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>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.
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions docker.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GITLAB_API_ENDPOINT=http://gitlab:3000/api/v4
GITLAB_API_PRIVATE_TOKEN=j3CLYZMg_dsTPpCR2HWf

0 comments on commit 8e38642

Please sign in to comment.