-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add docker image for development (#280)
* Refactor test to verify on general error case - Duplicate cert error is already verified in Ruby spec - Duplicate cert error does not always throw error (ie. for OpenSSL < 1.1.1) * Add Dockerfile for testing/development purposes * Update developer setup doc
- Loading branch information
Showing
4 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/.git | ||
tmp |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,55 @@ | ||
# Developer setup | ||
|
||
## Preparation | ||
|
||
### With virtual battery | ||
|
||
* Build an initial local image with Docker | ||
```sh | ||
docker build --rm -t pact_broker:dev . | ||
``` | ||
|
||
* Spin up a container with mounted volume and open an interactive shell session | ||
```sh | ||
docker run --rm -v $(PWD):/app -w /app -it pact_broker:dev bash | ||
``` | ||
|
||
### With native install | ||
|
||
* You will need to install Ruby 2.5, and preferably a ruby version manager. I recommend using [chruby][chruby] and [ruby-install][ruby-install]. | ||
* Install bundler (the Ruby gem dependency manager) `gem install bundler` | ||
* Check out the pact_broker repository and cd into it. | ||
* Run `bundle install`. If you have not got mysql or postgres installed locally, comment out the `mysql2` and `pg` development dependency lines in `pact_broker.gemspec`, as these are only really required on Travis. | ||
* Run `bundle exec rake pact_broker:dev:setup`. This will create an example application that you can run locally, that uses the local source code. | ||
* To run the example: | ||
|
||
cd dev | ||
bundle install | ||
bundle exec rackup | ||
## Running a local application | ||
|
||
* Run `bundle exec rake pact_broker:dev:setup`. This will create an example application that you can run locally, that uses the local source code. | ||
* To run the example: | ||
```sh | ||
cd dev | ||
bundle install | ||
bundle exec rackup | ||
``` | ||
* The application will be available on `http://localhost:9292` | ||
|
||
## Running the tests | ||
|
||
To run everything (specs, pact verifications, vulnerability scan...): | ||
|
||
`bundle exec rake` | ||
|
||
To run a smaller subset of the tests: | ||
|
||
`bundle exec rake spec` | ||
|
||
To run the "quick tests" (skip the lengthy migration specs) | ||
|
||
`bundle exec rake spec:quick` | ||
|
||
To run a single spec: | ||
|
||
`bundle exec rspec path_to_your_spec.rb` | ||
* To run everything (specs, pact verifications, vulnerability scan...): | ||
```sh | ||
bundle exec rake | ||
``` | ||
* To run a smaller subset of the tests: | ||
```sh | ||
bundle exec rake spec | ||
``` | ||
* To run the "quick tests" (skip the lengthy migration specs) | ||
```sh | ||
bundle exec rake spec:quick | ||
``` | ||
* To run a single spec: | ||
```sh | ||
bundle exec rspec path_to_your_spec.rb | ||
``` | ||
|
||
[chruby]: https://github.com/postmodern/chruby | ||
[ruby-install]: https://github.com/postmodern/ruby-install |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM ruby:2.5.3-alpine | ||
|
||
RUN apk update \ | ||
&& apk --no-cache add \ | ||
"build-base>=0.5" \ | ||
"bash>=4.4" \ | ||
"ca-certificates>=20190108" \ | ||
"git>=2.20" \ | ||
"postgresql-dev>=11.3" \ | ||
"sqlite-dev>=3.28" \ | ||
"sqlite>=3.28" \ | ||
"tzdata>=2019" \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
WORKDIR /app | ||
|
||
COPY . ./ | ||
|
||
RUN gem install bundler -v '~>2.0.0' \ | ||
&& bundle install --jobs 3 --retry 3 | ||
|
||
CMD [] |
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