-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
59 lines (45 loc) · 1.34 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM ruby:3.0.1-alpine3.13
ENV APP_PATH=/var/app
ENV BUNDLE_VERSION=2.2.17
ENV RAILS_PORT=3000
ARG RAILS_SERVE_STATIC_FILES=true
ENV RAILS_SERVE_STATIC_FILES ${RAILS_SERVE_STATIC_FILES}
ARG RAILS_ENV=production
ENV RAILS_ENV ${RAILS_ENV}
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# install dependencies for application
RUN apk -U add --no-cache \
build-base \
git \
postgresql-dev \
postgresql-client \
libxml2-dev \
libxslt-dev \
nodejs \
npm \
yarn \
tzdata \
&& rm -rf /var/cache/apk/* \
&& mkdir -p $APP_PATH
ENV CC=clang
ENV CXX=clang++
RUN gem install 'specific_install'
RUN gem specific_install -l "https://github.com/sagarjauhari/mini_racer"
RUN gem install bundler --version "$BUNDLE_VERSION"
# navigate to app directory
WORKDIR $APP_PATH
COPY . .
RUN rm -f Gemfile.lock
RUN bundle lock --add-platform x86_64-linux-musl
RUN bundle install
RUN yarn install --check-files
# creating a log directory so that image wont fail when RAILS_LOG_TO_STDOUT is false
RUN mkdir -p /app/log
# generate production assets if production environment
RUN if [ "$RAILS_ENV" = "production" ]; then \
SECRET_KEY_BASE=precompile_placeholder RAILS_LOG_TO_STDOUT=enabled bundle exec rake assets:precompile \
&& rm -rf spec node_modules tmp/cache; \
fi
EXPOSE 3000
CMD rails s -p $RAILS_PORT -b 0.0.0.0