Skip to content

Commit 2f55a00

Browse files
committed
remove pid on start production
1 parent 423880f commit 2f55a00

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ COPY . .
2525

2626
RUN bin/rails assets:precompile
2727

28-
CMD ["bash", "-c", "bin/rails db:prepare && bin/rails server"]
28+
CMD ["bash", "-c", "make db-prepare && make start"]

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ ruby '~> 3.2.2'
77

88
gem 'bootsnap', require: false
99
gem 'cssbundling-rails'
10+
# NOTE: должен быть в dev или test зависимостью. Испольузем для заполнения БД для демонстрации
11+
gem 'faker'
1012
gem 'flash_rails_messages'
1113
gem 'jbuilder'
1214
gem 'jsbundling-rails'
@@ -22,7 +24,6 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
2224

2325
group :development, :test do
2426
gem 'debug', platforms: %i[mri mingw x64_mingw]
25-
gem 'faker'
2627
gem 'rubocop'
2728
gem 'rubocop-performance'
2829
gem 'rubocop-rails'

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
start:
2-
rm -rf tmp/pids/server.pid
3-
bin/rails s -b 0.0.0.0
4-
2+
rm -rf tmp/pids/server.pid || true
3+
bin/rails s
54
setup: install db-prepare
65

76
install:
@@ -23,4 +22,12 @@ lint:
2322
lint-fix:
2423
bundle exec rubocop -A
2524

25+
compose-production-run-app:
26+
docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml build
27+
docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml up
28+
29+
compose-production-console:
30+
docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml exec app bin/rails console
31+
32+
2633
.PHONY: test

config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
4949

5050
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
51-
# config.force_ssl = true
51+
config.force_ssl = false
5252

5353
# Include generic and useful information about system operation, but avoid logging too much
5454
# information to avoid inadvertent exposure of personally identifiable information (PII).

docker-compose.production.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
services:
4+
app:
5+
build:
6+
dockerfile: Dockerfile
7+
context: .
8+
environment:
9+
PORT: 3000
10+
SECRET_KEY_BASE: test
11+
RAILS_ENV: production
12+
ports:
13+
- 3000:3000

0 commit comments

Comments
 (0)