Fix docker image

Fix bunch of things with docker and add entry.sh
This commit is contained in:
Ari Timonen 2018-04-14 13:02:58 +00:00
parent 4a8bd8ee7d
commit 3984ad2442
7 changed files with 29 additions and 11 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
/log/*
/tmp/*
/spec/tmp/*
/env/*
.ruby-version
.ruby-gemset
.env

View file

@ -29,10 +29,15 @@ USER web
WORKDIR /var/www
COPY .env /var/www/
RUN bundle install --path /var/bundle
RUN bundle exec rake assets:precompile
RUN bundle install --path /var/bundle --jobs 4
#RUN bundle exec rake assets:precompile
# When using bash
USER root
CMD ["bundle", "exec", "puma", "-C /var/www/config/puma.rb"]
RUN apt-get install -y memcached
RUN service memcached start
#USER root
USER web
CMD ["/var/www/entry.sh"]

View file

@ -10,6 +10,7 @@ module Ensl
# Additional assets
config.assets.precompile += ["themes/*/theme.css", "themes/*/errors.css"]
config.assets.initialize_on_precompile = false
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += Dir["#{config.root}/app/services/**/", "#{config.root}/app/models/concerns/"]

View file

@ -1,7 +1,7 @@
base: &db
adapter: mysql2
encoding: utf8
host: <%= ENV['MYSQL_HOST'] || 'localhost' %>
host: <%= ENV['MYSQL_HOST'] %>
database: <%= ENV['MYSQL_DATABASE'] %>
username: <%= ENV['MYSQL_USERNAME'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>

View file

@ -64,4 +64,7 @@ Ensl::Application.configure do
# Custom Session Store config to allow gathers.staging.ensl.org
config.session_store :cookie_store, key: "_ENSL_session_key", expire_after: 30.days.to_i, domain: ".ensl.org"
end
# config.cache_store = :dalli_store, 'cache', 'cache-2.example.com:11211:2',
# { :namespace => NAME_OF_RAILS_APP, :expires_in => 1.day, :compress => true }
end

6
entry.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
env|grep -i MYSQL
cd /var/www
bundle exec rake assets:precompile
bundle exec puma -C config/puma.rb

12
fig.yml
View file

@ -1,9 +1,11 @@
web:
image: ensl/ensl.org
image: ensl
links:
- mysql
- redis
# - redis
mysql:
image: mysql
redis:
image: redis
image: mysql/mysql-server
volumes:
- /srv/ensl/mysql:/var/lib/mysql
#redis:
# image: redis