Skip to content

Instantly share code, notes, and snippets.

@bcardiff
Created January 22, 2020 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcardiff/3916e61bcce03959748468e89b53d19a to your computer and use it in GitHub Desktop.
Save bcardiff/3916e61bcce03959748468e89b53d19a to your computer and use it in GitHub Desktop.
Generate rails-assets packages

Rails assets

$ git clone https://github.com/tenex/rails-assets.git
$ cd rails-assets/

Copy config/database.yml and config/application.yml. The only relevant change is the db host.

$ docker-compose run --rm app bash

Inside app docker container

# bundle install && npm install
# bin/rake db:setup
# echo '{ "allow_root": true }' > /root/.bowerrc
# bin/rake 'component:convert[momentjs,2.22.2]'

Generating gemspec.rz for rails-assets-momentjs-2.22.2...
rake aborted!
NoMethodError: undefined method `abbreviate' for #<Gem::Indexer:0x000000066cd788>
/src/app/workers/reindex.rb:80:in `gemspec_rz'

Despite the undefined method abbreviate error, ./public/gems/rails-assets-momentjs-2.22.2.gem is generated.

# gem unpack public/gems/rails-assets-momentjs-2.22.2.gem

Will leave the rails-assets-momentjs-2.22.2 that can be vendored in your project.

# Todo: Don't really need this file - delete it.
# Replace with a local file with real values
# and put production values in ansible vault
DATA_DIR: <%= File.expand_path("../public", __FILE__) %>
RAVEN_DSN: ""
SIDEKIQ_PASSWORD: ""
NEWRELIC_LICENSE_KEY: ""
STRIPE_PUBLISHABLE_KEY: ""
STRIPE_SECRET_KEY: ""
default: &default
host: db
adapter: postgresql
pool: 30
timeout: 5000
encoding: unicode
development:
<<: *default
database: rails_assets_development
test:
<<: *default
database: rails_assets_test
staging:
<<: *default
database: rails_assets_staging
username: rails_assets
production:
<<: *default
database: rails_assets_production
username: rails_assets
host: 10.132.45.214
version: '3.4'
services:
app:
build: .
pid: host
working_dir: /src
depends_on:
- db
- redis
environment:
REDIS_URL: redis://redis
volumes:
- .:/src
- bundle:/usr/local/bundle
- node_modules:/src/node_modules
redis:
image: redis:alpine
volumes:
- redis:/data
db:
image: postgres:9.6-alpine
environment:
POSTGRES_USER: root
volumes:
- db:/var/lib/postgresql/data
volumes:
db:
bundle:
node_modules:
redis:
FROM ruby:2.2
RUN \
# node
curl -sL https://deb.nodesource.com/setup_5.x | bash - && \
apt-get install -y nodejs && \
# cleanup
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment