Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Use production env to compile prod assets (bugfix)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincemtnz committed Mar 22, 2018
1 parent 86861a0 commit c8685e1
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ jobs:
paths:
- public

precompile_production_assets:
# TODO: change epoch in cache key to git commit sha of the last commit in the sou-assets repo
# (Branch is either current branch, $DEFAULT_ASSET_BRANCH, or 'master', in that order):
# git ls-remote git://github.com/SumOfUs/sou-assets.git \ grep refs/heads/master | cut -f 1
<<: *defaults
environment:
RAILS_ENV: production
NODE_ENV: production
steps:
- checkout
- attach_workspace:
at: ~/circleci-champaign
- run: bundle install --path vendor/bundle
- run:
name: Precompile assets
# NOTE: Webpacker runs yarn on asset precompilation so this will install production assets into node_modules!
command: bundle exec rake assets:precompile
- persist_to_workspace:
root: .
paths:
- public

rspec:
working_directory: ~/circleci-champaign
docker:
Expand Down Expand Up @@ -121,6 +143,18 @@ jobs:
name: Docker build
command: .circleci/build.sh

build_production_docker_image:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/circleci-champaign
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Docker build
command: .circleci/build.sh

deploy_production:
<<: *defaults
steps:
Expand Down Expand Up @@ -170,14 +204,24 @@ workflows:
requires:
- install_dependencies

- precompile_assets:
- precompile_production_assets:
requires:
- install_dependencies
context: champaign-production
# Only precompile assets when we need to build and deploy
filters:
branches:
only:
- master

- precompile_assets:
requires:
- install_dependencies
context: champaign-staging
# Only precompile assets when we need to build and deploy
filters:
branches:
only:
- development
- /^feature(?:\/|-).+$/

Expand All @@ -191,9 +235,17 @@ workflows:
- development
- /^feature(?:\/|-).+$/

- build_production_docker_image:
requires:
- precompile_production_assets
filters:
branches:
only:
- master

- deploy_production:
requires:
- build_docker_image
- build_production_docker_image
- rspec
- jest
- flow
Expand Down

0 comments on commit c8685e1

Please sign in to comment.