-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (59 loc) · 1.77 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
60
61
62
63
64
65
66
67
68
69
70
71
72
# TODO: change to slim or alpine
FROM ruby:2.6.5
ARG username
ARG service_key
# Add build and runtime dependencies
# TODO: separate build & runtime and purge build dependencies at the end
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Install phantomjs dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bzip2 \
libfontconfig \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install phantomjs & clean up
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
&& mkdir /tmp/phantomjs \
&& curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 \
| tar -xj --strip-components=1 -C /tmp/phantomjs \
&& cd /tmp/phantomjs \
&& mv bin/phantomjs /usr/local/bin \
&& cd \
&& apt-get purge --auto-remove -y \
curl \
&& apt-get clean \
&& rm -rf /tmp/* /var/lib/apt/lists/*
# Build and package the app
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
# Add Contrast instrumentation
RUN gem install bundler
RUN bundle add contrast-agent
RUN bundle install
ADD ./app /myapp/app
ADD ./config /myapp/config
ADD ./db /myapp/db
ADD ./doc /myapp/doc
ADD ./lib /myapp/lib
ADD ./log /myapp/log
ADD ./public /myapp/public
ADD ./script /myapp/script
ADD ./spec /myapp/spec
RUN mkdir /myapp/tmp
ADD ./vendor /myapp/vendor
ADD ./config.ru /myapp/config.ru
ADD ./entrypoint.sh /myapp/entrypoint.sh
ADD ./Rakefile /myapp/Rakefile
COPY ./contrast_security.yaml /myapp/contrast_security.yaml
#Setup the database
RUN rails db:setup
# Make port 3000 available
EXPOSE 3000
# Start the app server
ENTRYPOINT [ "/myapp/entrypoint.sh"]