forked from ruilisi/rails-pangu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
26 lines (23 loc) · 976 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
FROM ruby:2.6.1-alpine3.9 as base
RUN echo "http://mirrors.ustc.edu.cn/alpine/v3.9/main/" > /etc/apk/repositories && \
echo "http://mirrors.ustc.edu.cn/alpine/v3.9/community/" >> /etc/apk/repositories
WORKDIR /usr/src/app
RUN apk add --no-cache tzdata libpq git && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
FROM base as bundler
RUN apk add --no-cache autoconf automake build-base postgresql-dev
COPY Gemfile.core .
RUN echo 'gem: --no-document' >> ~/.gemrc && \
cp ~/.gemrc /etc/gemrc && \
chmod +r /etc/gemrc && \
bundle install --gemfile Gemfile.core -j16 --binstubs=$BUNDLE_PATH/bin
COPY Gemfile .
COPY Gemfile.lock .
RUN bundle install --gemfile Gemfile -j16 --binstubs=$BUNDLE_PATH/bin
FROM base as release
COPY --from=bundler /usr/local/bundle/ /usr/local/bundle/
COPY . .
RUN ruby bin/gen_cronjobs.rb | crontab -
ENTRYPOINT ["sh", "bin/entrypoint.sh"]
CMD ["bundle", "exec", "puma"]