forked from psu-libraries/scholarsphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (32 loc) · 944 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM psul/ruby:2.6.3-node-12 as base
COPY bin/vaultshell /usr/local/bin/
RUN useradd -u 2000 app -d /app
RUN mkdir /app/tmp
RUN chown -R app /app
USER app
COPY Gemfile Gemfile.lock /app/
COPY --chown=app vendor/ vendor/
RUN gem install bundler:2.0.2
RUN bundle install --path vendor/bundle && \
rm -rf /app/.bundle/cache && \
rm -rf /app/vendor/bundle/ruby/*/cache
COPY package.json yarn.lock /app/
RUN yarn --frozen-lockfile && \
rm -rf /app/.cache && \
rm -rf /app/tmp
COPY --chown=app . /app
CMD ["./entrypoint.sh"]
# Final Target
FROM base as production
RUN RAILS_ENV=production \
DEFAULT_URL_HOST=localhost \
SECRET_KEY_BASE=$(bundle exec rails secret) \
AWS_BUCKET=bucket \
AWS_ACCESS_KEY_ID=key \
AWS_SECRET_ACCESS_KEY=secret \
AWS_REGION=us-east-1 \
bundle exec rails assets:precompile && \
rm -rf /app/.cache/ && \
rm -rf /app/node_modules/.cache/ && \
rm -rf /app/tmp/
CMD ["./entrypoint.sh"]