diff --git a/Dockerfile b/Dockerfile index 6a36f32..eb6cdd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,4 +25,4 @@ COPY . . RUN bin/rails assets:precompile -CMD ["bash", "-c", "bin/rails db:prepare && bin/rails server"] +CMD ["bash", "-c", "make db-prepare && make start"] diff --git a/Gemfile b/Gemfile index 8343221..04641ee 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,8 @@ ruby '~> 3.2.2' gem 'bootsnap', require: false gem 'cssbundling-rails' +# NOTE: должен быть в dev или test зависимостью. Испольузем для заполнения БД для демонстрации +gem 'faker' gem 'flash_rails_messages' gem 'jbuilder' gem 'jsbundling-rails' @@ -22,7 +24,6 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] group :development, :test do gem 'debug', platforms: %i[mri mingw x64_mingw] - gem 'faker' gem 'rubocop' gem 'rubocop-performance' gem 'rubocop-rails' diff --git a/Makefile b/Makefile index 6352067..8b64a56 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ start: - rm -rf tmp/pids/server.pid - bin/rails s -b 0.0.0.0 - + rm -rf tmp/pids/server.pid || true + bin/rails s setup: install db-prepare install: @@ -23,4 +22,12 @@ lint: lint-fix: bundle exec rubocop -A +compose-production-run-app: + docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml build + docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml up + +compose-production-console: + docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml exec app bin/rails console + + .PHONY: test diff --git a/config/environments/production.rb b/config/environments/production.rb index 5b34930..ebd8156 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -48,7 +48,7 @@ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = false # Include generic and useful information about system operation, but avoid logging too much # information to avoid inadvertent exposure of personally identifiable information (PII). diff --git a/docker-compose.production.yml b/docker-compose.production.yml new file mode 100644 index 0000000..6294760 --- /dev/null +++ b/docker-compose.production.yml @@ -0,0 +1,13 @@ +--- + +services: + app: + build: + dockerfile: Dockerfile + context: . + environment: + PORT: 3000 + SECRET_KEY_BASE: test + RAILS_ENV: production + ports: + - 3000:3000