-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-rails
38 lines (28 loc) · 1.07 KB
/
Dockerfile-rails
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
26
27
28
29
30
31
32
33
34
35
36
37
38
# Base image:
FROM rails
# node.js の環境変数を定義する
# 本番環境では production
ENV NODE_ENV=development
# 必要なライブラリインストール
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
# yarnパッケージ管理ツールインストール
RUN apt-get update && apt-get install -y
curl apt-transport-https wget && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y yarn
# Node.jsをインストール
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /home
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
WORKDIR $RAILS_ROOT
# Gems:
COPY app/Gemfile $RAILS_ROOT
COPY app/Gemfile.lock $RAILS_ROOT
RUN gem install bundler
RUN bundle install
# Copy the main application.
COPY ./ .
EXPOSE 3000