Add Docker deployment files for Unity infrastructure migration
This commit is contained in:
@@ -1,2 +1,7 @@
|
|||||||
.git
|
.git
|
||||||
.dockerignore
|
log/*
|
||||||
|
tmp/*
|
||||||
|
vendor/bundle
|
||||||
|
node_modules
|
||||||
|
.bundle
|
||||||
|
.DS_Store
|
||||||
|
|||||||
54
Dockerfile
54
Dockerfile
@@ -1,20 +1,34 @@
|
|||||||
FROM ruby:2.5
|
FROM ruby:2.6.10-slim-bullseye
|
||||||
RUN apt-get update -qq && apt-get install -y build-essential libmariadb-dev libcups2-dev libpq-dev nodejs tzdata
|
|
||||||
RUN mkdir /sxrestaurant
|
# Install dependencies (MySQL client + ImageMagick for CarrierWave/MiniMagick)
|
||||||
RUN mkdir -p /sxrestaurant/tmp/puma
|
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
|
||||||
ENV RAILS_ENV production
|
build-essential \
|
||||||
ENV RACK_ENV production
|
default-libmysqlclient-dev \
|
||||||
WORKDIR /sxrestaurant
|
nodejs \
|
||||||
#RUN gem install bundler
|
git \
|
||||||
#COPY Gemfile /sxrestaurant/Gemfile
|
curl \
|
||||||
#COPY Gemfile.lock /sxrestaurant/Gemfile.lock
|
imagemagick \
|
||||||
#RUN bundle install --without development test
|
libmagickwand-dev \
|
||||||
RUN echo "Asia/Rangoon" > /etc/timezone
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
RUN dpkg-reconfigure -f noninteractive tzdata
|
|
||||||
RUN date
|
WORKDIR /app
|
||||||
COPY . /sxrestaurant
|
|
||||||
RUN gem install bundler
|
# Install gems
|
||||||
#RUN bundle update --bundler
|
COPY Gemfile Gemfile.lock ./
|
||||||
RUN bundle install --without development test
|
RUN bundle install --deployment --without development test --jobs 4
|
||||||
RUN bundle exec rake assets:precompile
|
|
||||||
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|
# 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