About Dockerfile

Dockerfile

The dockerfile is used to create a new image of docker This configuration file contains the files and packages needed to run the rails application. The definition for inclusion in the image is written.

Dockerfile.


1 FROM ruby:2.4.5
2 RUN apt-get update -qq && apt-get install -y build-essential nodejs
3 RUN mkdir /app
4 WORKDIR /app
5 COPY Gemfile /app/Gemfile
6 COPY Gemfile.lock /app/Gemfile.lock
7 RUN bundle install
8 COPY . /app

The part before 1: is called the repository. The part after: is called a tag. In this case, it shows the 2.4.5 tag of the ruby ​​repository.

2 Defines a command to start a container from the image of ruby ​​2.4.5 and execute it in the container. I have installed build-essential nodejs with apt-get, ubuntu's package management system. Required for Rails to work

3 Create an app directory in the root directory

4 Move the working directory to the app directory

5,6 Copy Gemfile and Gemfilelock on your PC to the app directory

7 Execute the gem installation command

8 Copy the contents of the folder where the docker file is located to the app directory

docker file → build → docker image is created

Recommended Posts

About Dockerfile
About =
About method.invoke
About Kotlin
About attr_accessor
About Hinemos
About inheritance
About params
About Docker
About Rails 6
Dockerfile memo
About form_for
About Spring ③
About enum
About polymorphism
About hashes
About JitPack
[Note] Dockerfile
About this ()
About devise
About encapsulation
About Docker
About JAVA_HOME
About active_hash
About static
About exceptions
About scope
[Maven] About Maven
About exception handling
Review about bundler
About Java interface
[Java] About Java 12 features
About Rails routing
About cyclomatic complexity
About AsyncTask Generics
Learn more about docker image and Dockerfile FROM
About Ruby symbols
About array multiplication
[Java] About arrays
About HotSpot VM
About ruby ​​form
[Swift] About generics
About Active Storage
About class inheritance.
About Spring AOP
About Ruby Hashes
About singular methods
About getter setter
About build tools
About MacinCloud introduction
[Note] About nil
Chew about API
[About double hash]
About installing Cocoapods
Something about java
Where about java
About HttpServlet () methods
About Java features
About ActiveRecord :: PendingMigrationError
About SIGNING_REGION: NoSuchFieldError
About the method