-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
42 lines (32 loc) · 1.2 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM ruby:2.7.8
ENV APP_HOME=/home/app
RUN groupadd -r app --gid=1000 \
&& useradd -r -m -g app -d $APP_HOME --uid=1000 app \
# Install system dependencies.
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& 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 \
default-libmysqlclient-dev \
nodejs \
yarn
WORKDIR $APP_HOME
# Install dependencies defined in Gemfile.
COPY Gemfile Gemfile.lock $APP_HOME/
RUN chown -R app:app $APP_HOME
RUN mkdir -p /opt/vendor/bundle \
&& chown -R app:app /opt/vendor \
&& su app -s /bin/bash -c "bundle install --path /opt/vendor/bundle"
# Copy the main application.
# NOTE: Use COPY --chown=app . $APP_HOME when Docker Hub will support it.
COPY . $APP_HOME
RUN chown -R app:app $APP_HOME
USER app
RUN ./bin/init_config \
&& bundle exec rake tmp:create yarn:install assets:precompile
EXPOSE 8080
# The main command to run when the container starts. Also
# tell the Rails dev server to bind to all interfaces by
# default.
CMD ["bundle", "exec", "puma", "--config", "config/puma.rb"]