/
Dockerfile
27 lines (23 loc) · 954 Bytes
/
Dockerfile
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
FROM ruby:3.1.2
RUN apt-get update -qq && apt-get install -y nodejs
ARG RAILS_MASTER_KEY
ENV RAILS_MASTER_KEY ${RAILS_MASTER_KEY}
# yarnパッケージ管理ツールをインストール
# https://classic.yarnpkg.com/en/docs/install/#debian-stable
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install yarn
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev mariadb-client nodejs
WORKDIR /myapp
COPY . /myapp
RUN bundle install
RUN yarn install
RUN RAILS_ENV=production SECRET_KEY_BASE=1 bundle exec rails assets:precompile
# Add a script to be executed every time the container starts
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
ENV TZ Asia/Tokyo
# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]