Skip to content

Latest commit

 

History

History
 
 

09-RUBY

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Docker Rails

Learning Dockerfile for Beginners

This project contains a simple and practical example of a Dockerfile to help beginners learn how to use Docker.

Prerequisites

  • Docker installed on your system
  • Basic knowledge of the Linux command line

Here's what each line does

  • FROM ruby:2.7-alpine: Use the official Ruby 2.7 image as our base image. We're using the Alpine version to keep the image small.

  • WORKDIR /app: Set the working directory in the container to /app.

  • COPY Gemfile Gemfile.lock ./: Copy the Gemfile and Gemfile.lock files from the current directory to the container.

  • RUN bundle install: Install the project dependencies using Bundler.

  • COPY . .: Copy the rest of the application code to the container.

  • CMD ["ruby", "app.rb"]: Set the command to start the application.

Usage

  1. Clone the repository:
git clone https://github.com/devopshobbies/docker-templates.git
  1. Build the Docker image:
cd docker-templates
docker build -t hello-ruby .
  1. Run the Docker container:
docker run -it --rm hello-ruby