Skip to content

Commit

Permalink
Update bundler & ensure GEM_HOME is set in container
Browse files Browse the repository at this point in the history
Also, add docker-compose.yml for local development & update README for
that workflow.
  • Loading branch information
aelkiss committed Oct 5, 2021
1 parent 136f904 commit a7da004
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ ARG UNAME=app
ARG UID=1000
ARG GID=1000
ARG APP_HOME=/app
ARG GEM_HOME=/gems

RUN gem install 'bundler:~>2.1.4'
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -d $APP_HOME -u $UID -g $GID -o -s /bin/bash $UNAME
RUN mkdir -p $GEM_HOME && chown $UID:$GID $GEM_HOME
RUN mkdir -p /gems && chown $UID:$GID /gems

USER $UNAME
RUN gem install 'bundler:~>1.17.3' 'bundler:~>2.0.2'
COPY --chown=$UID:$GID Gemfile* ${APP_HOME}/
ENV BUNDLE_GEMFILE=${APP_HOME}/Gemfile
ENV BUNDLE_PATH=${GEM_HOME}
ENV BUNDLE_GEMFILE ${APP_HOME}/Gemfile
ENV BUNDLE_PATH /gems
WORKDIR ${APP_HOME}

RUN bundle install
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Puppet Nebula
# Development

1. git clone
2. bundle
3. `(bundle exec) rake spec_prep`
4. `(bundle exec) rspec # or rake spec_standalone`
2. `docker-compose build`
3. `docker-compose run spec_prep`
4. `docker-compose run specs`

or:

```bash
docker-compose run specs bundle exec rspec specs/path/to/a_spec.rb
docker-compose run specs bundle exec rake spec_standalone
```
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3'
services:
specs:
build: .
command: 'bundle exec rake spec'
volumes:
- .:/app

spec_prep:
build: .
command: 'bundle exec rake spec_prep'
volumes:
- .:/app

lint:
build: .
command:
- /bin/bash
- '-c'
- 'bundle exec rake rubocop && bundle exec rake syntax lint && bundle exec rake metadata_lint'
volumes:
- .:/app

0 comments on commit a7da004

Please sign in to comment.