DevCEDTeam / CED

0 stars 0 forks source link

Step 1 Dockerize your Sinatra web application: #9

Open DevCEDTeam opened 1 year ago

DevCEDTeam commented 1 year ago
  1. Create a Dockerfile in the root directory of your Sinatra project.
  2. Add the following content to the Dockerfile:
# Use the official Ruby base image
FROM ruby:2.7

# Set the working directory
WORKDIR /app

# Copy the Gemfile and Gemfile.lock
COPY Gemfile Gemfile.lock ./

# Install dependencies
RUN bundle install --without development test

# Copy the application code
COPY . .

# Set the default command to run the Sinatra application
CMD ["ruby", "app.rb"]

This Dockerfile sets up a Ruby 2.7 environment, installs the dependencies using bundle install, and copies the application code to the /app directory. It then sets the default command to run the Sinatra application by executing ruby app.rb.