Docker Setup

This commit is contained in:
Julian
2018-04-11 11:24:34 +06:30
parent 27e70f1a86
commit 8b2f36fbc5
6 changed files with 51 additions and 2 deletions

1
.code2lab.env Normal file
View File

@@ -0,0 +1 @@
RAILS_ENV=production

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
.git
.dockerignore

12
Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM ruby:2.4.1
RUN apt-get update -qq && apt-get install -y build-essential libmysqlclient-dev libcups2-dev libpq-dev nodejs
RUN mkdir /sxrestaurant
RUN mkdir -p /sxrestaurant/tmp/puma
ENV RAILS_ENV production
WORKDIR /sxrestaurant
COPY Gemfile /sxrestaurant/Gemfile
COPY Gemfile.lock /sxrestaurant/Gemfile.lock
RUN bundle install --without development test
RUN bundle exec rails assets:precompile
COPY . /sxrestaurant

View File

@@ -3,6 +3,8 @@ require_relative 'boot'
require 'csv' require 'csv'
require 'rails/all' require 'rails/all'
# require 'iconv' # require 'iconv'
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
# Require the gems listed in Gemfile, including any gems # Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.

View File

@@ -1,6 +1,7 @@
application_path = '/home/superuser/Application/sxrestaurant' application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path directory application_path
environment ENV.fetch("RAILS_ENV") { "production" } #environment ENV.fetch("RAILS_ENV") { "production" }
environment "production"
pidfile "#{application_path}/tmp/puma/pid" pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state" state_path "#{application_path}/tmp/puma/state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"

31
docker-compose.yml Normal file
View File

@@ -0,0 +1,31 @@
version: '3'
services:
code2lab:
build: .
links:
- redis
command: bundle exec puma -C config/puma.rb
volumes:
- .:/sxrestaurant
env_file:
- .code2lab.env
ports:
- '8081:62158'
environment:
- REDIS_URL=redis://redis:6379/0
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
links:
- redis
volumes:
- .:/sxrestaurant
environment:
- REDIS_URL=redis://redis:6379/0
redis:
image: redis
ports:
- '6379:6379'
volumes:
- ../data/redis:/data