-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Docker for staging deploys in Heroku
This will build a container using GitHub actions and push to Heroku staging when a push is made to the `staging` branch. Resolve tool dependency issues Bower was incorrectly resolving dependencies and somehow restoring very old versions of components when building assets. I've traced this down to an issue in the resolver that is mitigated by using a regular gem source, rather than github dependencies.
- Loading branch information
Showing
5 changed files
with
157 additions
and
75 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,29 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches: [ 'staging', 'heroku-docker' ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Login to Heroku container registry | ||
run: | | ||
cat >~/.netrc <<EOF | ||
machine api.heroku.com | ||
login ${{ secrets.HEROKU_API_EMAIL }} | ||
password ${{ secrets.HEROKU_API_KEY }} | ||
machine git.heroku.com | ||
login ${{ secrets.HEROKU_API_EMAIL }} | ||
password ${{ secrets.HEROKU_API_KEY }} | ||
EOF | ||
heroku container:login | ||
- name: Push containers to Heroku | ||
run: | | ||
heroku container:push web worker --recursive \ | ||
--app staging-partner-tools \ | ||
--arg BUNDLE_GEM__FURY__IO=${{ secrets.BUNDLE_GEM__FURY__IO }},BUNDLE_GITHUB__COM=${{ secrets.BUNDLE_GITHUB__COM }},BUNDLE_GEMS__RAILSLTS__COM=${{ secrets.BUNDLE_GEMS__RAILSLTS__COM }} | ||
- name: Release containers to Heroku | ||
run: 'heroku container:release web worker --app staging-partner-tools' |
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,32 @@ | ||
FROM ruby:2.7.7 | ||
|
||
RUN apt-get update -qq && apt-get install -y build-essential nodejs npm | ||
|
||
RUN mkdir /myapp | ||
WORKDIR /myapp | ||
|
||
ARG BUNDLE_GEM__FURY__IO | ||
ARG BUNDLE_GEMS__RAILSLTS__COM | ||
ARG BUNDLE_GITHUB__COM | ||
|
||
ENV BUNDLE_GEM__FURY__IO ${BUNDLE_GEM__FURY__IO} | ||
ENV BUNDLE_GEMS__RAILSLTS__COM ${BUNDLE_GEMS__RAILSLTS__COM} | ||
ENV BUNDLE_GITHUB__COM ${BUNDLE_GITHUB__COM} | ||
|
||
ENV RAILS_ENV production | ||
ENV ALGOLIA_APP_ID NA | ||
ENV ALGOLIA_API_KEY NA | ||
ENV FRONTEND_HTTP_REQUEST_TIMEOUT 10 | ||
ENV BUNDLE_WITHOUT test:development | ||
|
||
COPY Gemfile* .ruby-version ./ | ||
RUN gem install bundler:1.17.3 | ||
RUN bundle install -j4 --retry 5 | ||
RUN npm install -g bower | ||
COPY . /myapp | ||
|
||
RUN rm -rf vendor/assets/bower_components | ||
RUN bundle exec bowndler update --allow-root --production | ||
RUN bundle exec rake assets:precompile | ||
|
||
CMD puma |
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,32 @@ | ||
FROM ruby:2.7.7 | ||
|
||
RUN apt-get update -qq && apt-get install -y build-essential nodejs npm | ||
|
||
RUN mkdir /myapp | ||
WORKDIR /myapp | ||
|
||
ARG BUNDLE_GEM__FURY__IO | ||
ARG BUNDLE_GEMS__RAILSLTS__COM | ||
ARG BUNDLE_GITHUB__COM | ||
|
||
ENV BUNDLE_GEM__FURY__IO ${BUNDLE_GEM__FURY__IO} | ||
ENV BUNDLE_GEMS__RAILSLTS__COM ${BUNDLE_GEMS__RAILSLTS__COM} | ||
ENV BUNDLE_GITHUB__COM ${BUNDLE_GITHUB__COM} | ||
|
||
ENV RAILS_ENV production | ||
ENV ALGOLIA_APP_ID NA | ||
ENV ALGOLIA_API_KEY NA | ||
ENV FRONTEND_HTTP_REQUEST_TIMEOUT 10 | ||
ENV BUNDLE_WITHOUT test:development | ||
|
||
COPY Gemfile* .ruby-version ./ | ||
RUN gem install bundler:1.17.3 | ||
RUN bundle install -j4 --retry 5 | ||
RUN npm install -g bower | ||
COPY . /myapp | ||
|
||
RUN rm -rf vendor/assets/bower_components | ||
RUN bundle exec bowndler update --allow-root --production | ||
RUN bundle exec rake assets:precompile | ||
|
||
CMD bundle exec rake jobs:work |
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