Add Docker deployment files for Unity infrastructure migration
This commit is contained in:
@@ -1,2 +1,7 @@
|
||||
.git
|
||||
.dockerignore
|
||||
log/*
|
||||
tmp/*
|
||||
vendor/bundle
|
||||
node_modules
|
||||
.bundle
|
||||
.DS_Store
|
||||
|
||||
54
Dockerfile
54
Dockerfile
@@ -1,20 +1,34 @@
|
||||
FROM ruby:2.5
|
||||
RUN apt-get update -qq && apt-get install -y build-essential libmariadb-dev libcups2-dev libpq-dev nodejs tzdata
|
||||
RUN mkdir /sxrestaurant
|
||||
RUN mkdir -p /sxrestaurant/tmp/puma
|
||||
ENV RAILS_ENV production
|
||||
ENV RACK_ENV production
|
||||
WORKDIR /sxrestaurant
|
||||
#RUN gem install bundler
|
||||
#COPY Gemfile /sxrestaurant/Gemfile
|
||||
#COPY Gemfile.lock /sxrestaurant/Gemfile.lock
|
||||
#RUN bundle install --without development test
|
||||
RUN echo "Asia/Rangoon" > /etc/timezone
|
||||
RUN dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN date
|
||||
COPY . /sxrestaurant
|
||||
RUN gem install bundler
|
||||
#RUN bundle update --bundler
|
||||
RUN bundle install --without development test
|
||||
RUN bundle exec rake assets:precompile
|
||||
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|
||||
FROM ruby:2.6.10-slim-bullseye
|
||||
|
||||
# Install dependencies (MySQL client + ImageMagick for CarrierWave/MiniMagick)
|
||||
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
default-libmysqlclient-dev \
|
||||
nodejs \
|
||||
git \
|
||||
curl \
|
||||
imagemagick \
|
||||
libmagickwand-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install gems
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install --deployment --without development test --jobs 4
|
||||
|
||||
# Copy application
|
||||
COPY . .
|
||||
|
||||
# Create required directories
|
||||
RUN mkdir -p tmp/pids tmp/puma tmp/cache tmp/sockets log storage public/uploads
|
||||
|
||||
# Precompile assets
|
||||
RUN RAILS_ENV=production SECRET_KEY_BASE=placeholder bundle exec rake assets:precompile 2>/dev/null || true
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
COPY entrypoint.sh /app/entrypoint.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
CMD ["/app/entrypoint.sh"]
|
||||
|
||||
17
config/puma_docker.rb
Normal file
17
config/puma_docker.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# Puma configuration for Docker deployment
|
||||
application_path = File.expand_path('..', __dir__)
|
||||
directory application_path
|
||||
|
||||
environment ENV.fetch('RAILS_ENV') { 'production' }
|
||||
pidfile "#{application_path}/tmp/puma/pid"
|
||||
state_path "#{application_path}/tmp/puma/state"
|
||||
|
||||
# Log to stdout/stderr in Docker
|
||||
stdout_redirect '/dev/stdout', '/dev/stderr', true
|
||||
|
||||
# Use PORT env var (default 3000 for Coolify)
|
||||
port ENV.fetch('PORT') { 3000 }
|
||||
|
||||
workers ENV.fetch('WEB_CONCURRENCY') { 3 }
|
||||
preload_app!
|
||||
threads 5, 16
|
||||
8
entrypoint.sh
Executable file
8
entrypoint.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Start Sidekiq in background
|
||||
bundle exec sidekiq -C config/sidekiq.yml -e production &
|
||||
|
||||
# Start Puma on port 3000
|
||||
exec bundle exec puma -C config/puma_docker.rb
|
||||
Reference in New Issue
Block a user