43 lines
1.3 KiB
Docker
43 lines
1.3 KiB
Docker
FROM ruby:2.6.10-slim-bullseye
|
|
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential libpq-dev nodejs git curl libv8-dev && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN gem install bundler:1.17.2
|
|
|
|
WORKDIR /app
|
|
|
|
COPY Gemfile Gemfile.lock ./
|
|
RUN bundle install --without development test --deployment --jobs 4
|
|
|
|
COPY . .
|
|
|
|
# Create gitignored config files
|
|
RUN cat <<'DBEOF' > config/database.yml
|
|
production:
|
|
adapter: postgresql
|
|
encoding: utf8
|
|
pool: 5
|
|
database: <%= ENV.fetch('DATABASE_NAME', 'nemo_encoder') %>
|
|
username: <%= ENV.fetch('DATABASE_USER', 'nemo') %>
|
|
password: <%= ENV.fetch('DATABASE_PASSWORD', '') %>
|
|
host: <%= ENV.fetch('DATABASE_HOST', 'localhost') %>
|
|
port: <%= ENV.fetch('DATABASE_PORT', '5432') %>
|
|
DBEOF
|
|
|
|
RUN cat <<'SECEOF' > config/secrets.yml
|
|
production:
|
|
secret_key_base: <%= ENV.fetch('SECRET_KEY_BASE', '14f1c43bf96e14022f9e517b6b4909070398497c26fd062cb280dedcc44f25c5146444bdf49ff8bbbb98869e9d7bfeaea5b5c12128bdb6660aec9169963a4429') %>
|
|
SECEOF
|
|
|
|
RUN mkdir -p tmp/pids tmp/puma tmp/cache tmp/sockets log storage
|
|
|
|
RUN RAILS_ENV=production SECRET_KEY_BASE=dummy DATABASE_HOST=localhost \
|
|
bundle exec rake assets:precompile 2>/dev/null || true
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb", "-p", "3000"]
|