-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
25 lines (18 loc) · 845 Bytes
/
Copy pathDockerfile
File metadata and controls
25 lines (18 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Use a slim Ruby image as the base
FROM ruby:4.0.2-slim
# Install system dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev libyaml-dev curl git && rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Install bundler
RUN gem install bundler
# Copy Gemfile and install dependencies
COPY Gemfile Gemfile.lock ./
RUN bundle install
# Copy the rest of the application code
COPY . .
# Expose the application port
EXPOSE 9292
# Define the command to start the application, including migrations
# This CMD instruction now clearly separates migration and server startup.
CMD ["bash", "-c", "export RACK_ENV=production && echo \"Running database migrations...\" && bundle exec rake db:migrate && echo \"Database migrations complete. Starting server...\" && exec bundle exec rackup -p 9292 -s thin"]