-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (39 loc) · 1.09 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
FROM harbor.k8s.libraries.psu.edu/library/ruby-3.1.6-node-16:20241218 AS base
ARG UID=2000
WORKDIR /app
RUN useradd -u $UID app -d /app
RUN mkdir /app/tmp
COPY Gemfile Gemfile.lock /app/
RUN chown -R app /app
USER app
RUN gem install bundler:2.1.4
RUN bundle config set path 'vendor/bundle'
RUN bundle install && \
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 ["/app/bin/start"]
FROM base as production
RUN RAILS_ENV=production \
bundle exec rails assets:precompile
CMD ["/app/bin/start"]
FROM base as ci
USER root
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
ENV RAILS_ENV=test
RUN apt-get update && apt-get install -y x11vnc \
xvfb \
fluxbox \
wget \
libnss3 \
wmctrl \
google-chrome-stable
USER app
FROM ci as test
RUN bundle
CMD ["sleep", "99999999"]