mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-02-03 06:51:04 +00:00
Update ensl.org for docker version
Create docker version - Remove rubyracer, use nodejs - Add Makefile and fig.yml examples - Update to v2 circle.yml sample - Create Dockerfile - Do not use nested folders in tmp for puma
This commit is contained in:
parent
811b49bc20
commit
4a8bd8ee7d
8 changed files with 89 additions and 15 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
Dockerfile
|
38
Dockerfile
Normal file
38
Dockerfile
Normal file
|
@ -0,0 +1,38 @@
|
|||
FROM ruby:2.2
|
||||
|
||||
ENV RAILS_ENV production
|
||||
|
||||
# Add 'web' user which will run the application
|
||||
RUN adduser web --home /home/web --shell /bin/bash --disabled-password --gecos ""
|
||||
|
||||
RUN apt-get update && apt-get -y upgrade
|
||||
RUN apt-get -y install mysql-client libmysqlclient-dev memcached nodejs
|
||||
|
||||
# Separate Gemfile ADD so that `bundle install` can be cached more effectively
|
||||
|
||||
ADD Gemfile /var/www/
|
||||
ADD Gemfile.lock /var/www/
|
||||
RUN chown -R web:web /var/www &&\
|
||||
mkdir -p /var/bundle &&\
|
||||
chown -R web:web /var/bundle
|
||||
|
||||
RUN bundle config github.https true
|
||||
RUN su -c "cd /var/www && bundle install --path /var/bundle" -s /bin/bash -l web
|
||||
|
||||
# Add application source
|
||||
ADD . /var/www
|
||||
RUN chown -R web:web /var/www
|
||||
|
||||
USER web
|
||||
|
||||
# Precompile assets
|
||||
|
||||
WORKDIR /var/www
|
||||
COPY .env /var/www/
|
||||
RUN bundle install --path /var/bundle
|
||||
RUN bundle exec rake assets:precompile
|
||||
|
||||
# When using bash
|
||||
USER root
|
||||
|
||||
CMD ["bundle", "exec", "puma", "-C /var/www/config/puma.rb"]
|
6
Gemfile
6
Gemfile
|
@ -1,6 +1,7 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
ruby '2.2.2'
|
||||
ruby '2.2.10'
|
||||
#ruby '2.2.2'
|
||||
|
||||
gem 'dotenv-rails', '~> 0.10.0'
|
||||
gem 'rails', '~> 3.2.22'
|
||||
|
@ -8,6 +9,7 @@ gem 'mysql2', '~> 0.3.17'
|
|||
gem 'dalli', '~> 2.7.0'
|
||||
gem 'puma', '~> 2.11.1'
|
||||
|
||||
gem 'i18n-js'
|
||||
gem 'exceptional', '~> 2.0.33'
|
||||
gem 'oj', '~> 2.5.5'
|
||||
gem 'faraday', '~> 0.9.0'
|
||||
|
@ -27,7 +29,7 @@ gem 'test-unit', '~> 3.1.3'
|
|||
gem 'google-api-client', '~> 0.10.3'
|
||||
|
||||
# Please install nodejs locally.
|
||||
gem 'therubyracer', '~> 0.12.1' if RUBY_PLATFORM == 'x86_64-linux'
|
||||
#gem 'therubyracer', '~> 0.12.1' if RUBY_PLATFORM == 'x86_64-linux'
|
||||
|
||||
gem 'sprockets', '~> 2.2.1'
|
||||
gem 'coffee-rails', '~> 3.2.2'
|
||||
|
|
28
Makefile
Normal file
28
Makefile
Normal file
|
@ -0,0 +1,28 @@
|
|||
PROJECT ?= abevoelker/example_rails_docker_ci
|
||||
TAG ?= latest
|
||||
|
||||
ifdef REGISTRY
|
||||
IMAGE=$(REGISTRY)/$(PROJECT):$(TAG)
|
||||
else
|
||||
IMAGE=$(PROJECT):$(TAG)
|
||||
endif
|
||||
|
||||
all:
|
||||
@echo "Available targets:"
|
||||
@echo " * build - build a Docker image for $(IMAGE)"
|
||||
@echo " * pull - pull $(IMAGE)"
|
||||
@echo " * push - push $(IMAGE)"
|
||||
@echo " * test - build and test $(IMAGE)"
|
||||
|
||||
build: Dockerfile
|
||||
docker build -t $(IMAGE) .
|
||||
|
||||
pull:
|
||||
docker pull $(IMAGE) || true
|
||||
|
||||
push:
|
||||
docker push $(IMAGE)
|
||||
|
||||
test: build
|
||||
fig run web ./env/test.sh ./test.sh
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
database:
|
||||
override:
|
||||
- mv config/database.circle.yml config/database.yml
|
||||
- bundle exec rake db:create db:schema:load --trace
|
|
@ -1,7 +1,7 @@
|
|||
base: &db
|
||||
adapter: mysql2
|
||||
encoding: utf8
|
||||
host: localhost
|
||||
host: <%= ENV['MYSQL_HOST'] || 'localhost' %>
|
||||
database: <%= ENV['MYSQL_DATABASE'] %>
|
||||
username: <%= ENV['MYSQL_USERNAME'] %>
|
||||
password: <%= ENV['MYSQL_PASSWORD'] %>
|
||||
|
|
|
@ -2,24 +2,24 @@ require "dotenv"
|
|||
Dotenv.load
|
||||
|
||||
base_path = (ENV['DEPLOY_PATH'] || Dir.pwd)
|
||||
current_path = "#{base_path}/current"
|
||||
shared_path = "#{base_path}/shared"
|
||||
stderr_path = "#{shared_path}/log/puma.stderr.log"
|
||||
stdout_path = "#{shared_path}/log/puma.stdout.log"
|
||||
#current_path = "#{base_path}/current"
|
||||
#shared_path = "#{base_path}/shared"
|
||||
stderr_path = "#{base_path}/lpuma.stderr.log"
|
||||
stdout_path = "#{base_path}/lpuma.stdout.log"
|
||||
|
||||
tag 'ENSL'
|
||||
|
||||
preload_app!
|
||||
daemonize true
|
||||
directory current_path
|
||||
pidfile "#{shared_path}/tmp/pids/puma.pid"
|
||||
state_path "#{shared_path}/tmp/pids/puma.state"
|
||||
directory base_path
|
||||
pidfile "#{base_path}/tmp/puma.pid"
|
||||
state_path "#{base_path}/tmp/puma.state"
|
||||
stdout_redirect stdout_path, stderr_path
|
||||
|
||||
environment ENV['RACK_ENV'] || 'production'
|
||||
rackup DefaultRackup
|
||||
|
||||
bind "unix://#{shared_path}/tmp/sockets/puma.sock"
|
||||
bind "unix://#{base_path}/tmp/puma.sock"
|
||||
port Integer(ENV['PUMA_PORT'] || 4000)
|
||||
|
||||
worker_timeout Integer(ENV['PUMA_TIMEOUT'] || 30)
|
||||
|
|
9
fig.yml
Normal file
9
fig.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
web:
|
||||
image: ensl/ensl.org
|
||||
links:
|
||||
- mysql
|
||||
- redis
|
||||
mysql:
|
||||
image: mysql
|
||||
redis:
|
||||
image: redis
|
Loading…
Reference in a new issue