-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update docker infra and fix image building and publishing in CI #60
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,8 @@ | ||
.git | ||
.dockerignore | ||
.byebug_history | ||
log | ||
tmp | ||
coverage | ||
# Required for puma to have a place to put the pid file | ||
!tmp/pids/.keep |
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
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,19 +1,27 @@ | ||
FROM ruby:2.7.0-alpine | ||
FROM ruby:2.7.1-alpine | ||
|
||
LABEL maintainer="Stanford Libraries Infrastructure Team <[email protected]>" | ||
|
||
RUN apk update && apk add build-base sqlite-dev tzdata git | ||
RUN apk add --update --no-cache \ | ||
build-base \ | ||
git \ | ||
postgresql-dev \ | ||
postgresql-client \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
tzdata | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
|
||
COPY Gemfile Gemfile.lock ./ | ||
RUN gem install bundler -v 2.0.2 | ||
RUN bundle install | ||
RUN gem update --system && \ | ||
gem install bundler && \ | ||
bundle config build.nokogiri --use-system-libraries | ||
|
||
COPY . . | ||
COPY Gemfile Gemfile.lock ./ | ||
|
||
RUN bundle exec rails db:setup | ||
RUN bundle config set without 'production' && bundle install | ||
|
||
LABEL maintainer="Justin Coyne <[email protected]>" | ||
COPY . . | ||
|
||
CMD puma -C config/puma.rb | ||
CMD ["./docker/invoke.sh"] |
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
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
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ NOTE: This is currently used for running specs; we still use https://github.com/ | |
|
||
Clone the repository | ||
|
||
$ git clone [email protected]:sul-dlss/suri_rails.git | ||
$ git clone [email protected]:sul-dlss/suri-rails.git | ||
|
||
Change directories into the app and install dependencies | ||
|
||
|
@@ -32,27 +32,35 @@ Start the development server | |
|
||
## Testing | ||
|
||
First, ensure the database container is spun up: | ||
|
||
$ docker-compose up db # use -d to daemonize/run in background | ||
|
||
And if you haven't yet prepared the test database, run: | ||
|
||
$ bin/rails db:setup | ||
|
||
The test suite (with RuboCop style enforcement) will be run with the default rake task (also run on CI). | ||
|
||
$ rake | ||
$ bin/rake | ||
|
||
The specs can be run without RuboCop enforcement | ||
|
||
$ rake spec | ||
$ bin/rake spec | ||
|
||
The RuboCop style enforcement can be run without running the tests | ||
|
||
$ rake rubocop | ||
$ bin/rake rubocop | ||
|
||
## Building for Docker | ||
|
||
```shell | ||
$ docker build -t suldlss/suri-rails:latest . | ||
``` | ||
Spin up the application and its database: | ||
|
||
$ docker-compose up --build | ||
|
||
## Updating Docker Image | ||
|
||
Then run as: | ||
```shell | ||
$ docker run -d -p 127.0.0.1:3002:3000 suldlss/suri-rails:latest | ||
``` | ||
Note that CI is configured to automatically update the image hosted on DockerHub on every commit to `master`. If you want to build and push an image manually, run: | ||
|
||
Note that CI is configured to automatically update the image hosted on DockerHub on every commit to `master`. | ||
$ docker build -t suldlss/suri-rails:latest . | ||
$ docker push suldlss/suri-rails:latest |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want to cache because ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndushay Good question! This caching is messed up in a few ways. First, it uses different keys for restore and save (dor-services vs. suri-rails). Second, I don't believe the cache is persisted across runs. So, basically, I think this is copypasta from some of our other repos where caching has been useful (e.g., in our GoLang and React work), and I'm removing it from Ruby/Rails projects whenever I see it.