forked from intrigueio/intrigue-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
88 lines (70 loc) · 3.22 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
FROM ubuntu:16.04
MAINTAINER Jonathan Cran <[email protected]>
RUN apt-get update -qq && apt-get -y upgrade && \
apt-get -y install libxml2-dev libxslt-dev zmap nmap sudo default-jre \
libsqlite3-dev sqlite3 git gcc g++ make libpcap-dev zlib1g-dev curl \
libcurl4-openssl-dev libpq-dev wget libgdbm-dev \
libncurses5-dev automake libtool bison libffi-dev libgmp-dev \
software-properties-common bzip2 gawk libreadline6-dev libyaml-dev pkg-config \
redis-server net-tools
# set up postgres
RUN sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
RUN sudo apt-get update
RUN sudo apt-get -y install postgresql postgresql-contrib
# Set up nginx?
# TODO
# Masscan build and installation
WORKDIR /usr/share
RUN git clone https://github.com/robertdavidgraham/masscan
WORKDIR /usr/share/masscan
RUN make -j 3 && make install
# create an app user (would require us setting up sudo)
#RUN useradd -ms /bin/bash app
#USER app
# Install rbenv and ruby-build
WORKDIR /root
RUN git clone https://github.com/sstephenson/rbenv.git /root/.rbenv
RUN git clone https://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build
RUN git clone https://github.com/rbenv/rbenv-default-gems.git /root/.rbenv/plugins/rbenv-default-gems
RUN /root/.rbenv/plugins/ruby-build/install.sh
ENV PATH /root/.rbenv/bin:$PATH
#RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
RUN echo 'eval "$(rbenv init -)"' >> .bashrc
# Install multiple versions of ruby
ENV CONFIGURE_OPTS --disable-install-doc
RUN rbenv install 2.3.1
RUN rbenv global 2.3.1
# Fix an rbenv path issue
RUN echo export PATH=/root/.rbenv/shims:$PATH >> /etc/profile.d/rbenv.sh
RUN echo export PATH=/root/.rbenv/shims:$PATH >> .bashrc
# Install the deps
# https://medium.com/@fbzga/how-to-cache-bundle-install-with-docker-7bed453a5800#.f2hrjsvnz
COPY Gemfile* /tmp/
WORKDIR /tmp
ENV BUNDLE_JOBS=12
RUN /bin/bash -l -c "gem install bundler"
RUN /bin/bash -l -c "bundle config --global silence_root_warning 1"
RUN /bin/bash -l -c "bundle install --system"
# get intrigue-core code
RUN /bin/bash -l -c "rm -rf /core && mkdir -p /core"
ADD . /core/
# check networks
#RUN /bin/bash -l -c "apt-get install net-tools && ifconfig && netstat -lnt"
# Migrate!
WORKDIR /core
# Ensure we listen on all ipv4 interfaces, and background the file
RUN cp /core/config/puma.rb.default /core/config/puma.rb
RUN sed -i "s/tcp:\/\/127.0.0.1:7777/tcp:\/\/0.0.0.0:7777/g" /core/config/puma.rb
RUN sed -i "s/daemonize true/daemonize false/g" /core/config/puma.rb
# Expose a port
EXPOSE 7777
# Set up the service file
RUN cp /core/util/control.sh.default /core/util/control.sh
RUN sed -i "s/\/path\/to\/install\/directory/\/core/g" /core/util/control.sh
RUN ln -s /core/util/control.sh /etc/init.d/intrigue
# Configure postgres
RUN /bin/bash -l -c "sed -i 's/md5/trust/g' /etc/postgresql/9.6/main/pg_hba.conf"
# start the app (also migrates DB)
CMD /bin/bash -l -c "PATH=/root/.rbenv/shims:$PATH && service postgresql start && service redis-server start && su - postgres -c 'createuser -d -w intrigue && createdb intriguedb' && service intrigue start"
#ENTRYPOINT "/bin/bash"