-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
145 lines (119 loc) · 3.82 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
FROM ubuntu:18.04
ENV TZ=Europe/Athens
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt upgrade -yq
RUN apt install -y \
wget \
python3-pip \
sudo \
sqlite3 \
libpq-dev \
libmysqlclient-dev \
default-jdk \
scala \
curl \
vim \
software-properties-common \
build-essential \
systemd \
ruby-full \
ruby-dev \
libsqlite3-dev \
locales
# Install node
RUN curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt install -y nodejs
# Install sbt
RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list
RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add
RUN apt update && apt install sbt -y
# Create the cynthia user.
RUN useradd -ms /bin/bash cynthia && \
echo cynthia:cynthia | chpasswd && \
cp /etc/sudoers /etc/sudoers.bak && \
echo 'cynthia ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
USER cynthia
ENV HOME /home/cynthia
WORKDIR ${HOME}
RUN mkdir ${HOME}/scripts
# Setup backends
ADD ./scripts/setup-sqlserver.sh ${HOME}/scripts/setup-sqlserver.sh
RUN ${HOME}/scripts/setup-sqlserver.sh
ADD ./scripts/setup-postgres.sh ${HOME}/scripts/setup-postgres.sh
RUN ${HOME}/scripts/setup-postgres.sh
ADD ./scripts/setup-mysql.sh ${HOME}/scripts/setup-mysql.sh
RUN ${HOME}/scripts/setup-mysql.sh
ADD ./scripts/setup-z3.sh ${HOME}/scripts/setup-z3.sh
RUN ${HOME}/scripts/setup-z3.sh
# Now cleanup helper scripts
RUN sudo rm -rf ${HOME}/scripts
USER cynthia
ADD ./patches/ ${HOME}/patches
# Add source code
RUN mkdir ${HOME}/cynthia_src
RUN mkdir ${HOME}/cynthia_src/scripts
ADD ./build.sbt ${HOME}/cynthia_src
ADD ./src ${HOME}/cynthia_src/src
ADD ./project/plugins.sbt ${HOME}/cynthia_src/project/plugins.sbt
ADD ./project/build.properties ${HOME}/cynthia_src/project/build.properties
ADD ./Makefile ${HOME}/cynthia_src/Makefile
ADD ./scripts/cynthia ${HOME}/cynthia_src/scripts/
ADD ./lib ${HOME}/cynthia_src/lib
RUN sudo chown -R cynthia:cynthia ${HOME}
WORKDIR ${HOME}/cynthia_src
# Build project
RUN make
RUN sudo make install
ENV CYNTHIA_JAR_FILE ${HOME}/cynthia_src/target/scala-2.13/cynthia.jar
WORKDIR ${HOME}
# Setup a Python3 virtual environment.
RUN sudo pip3 install virtualenv
# Clone Python ORMs
RUN git clone https://github.com/django/django
RUN git clone https://github.com/sqlalchemy/sqlalchemy
RUN git clone https://github.com/coleifer/peewee && \
cd peewee && \
patch < ${HOME}/patches/pwiz.patch && \
patch < ${HOME}/patches/peewee.patch
# Install necessary npm packages
RUN sudo npm install --unsafe-perm -g \
sqlite3 \
pg pg-hstore \
mysql \
tedious \
sequelize \
sequelize-auto
RUN npm install --save \
sqlite3 \
pg pg-hstore \
mysql \
tedious \
sequelize
# Install ruby packages
RUN sudo gem install sqlite3 mysql2 postgres activerecord pg \
activerecord-cockroachdb-adapter ruby-odbc sql_server
RUN git clone https://github.com/theosotr/rmre && \
cd rmre && \
gem build rmre.gemspec && \
sudo gem install rmre-0.0.9.gem && \
cd .. && \
rm -rf rmre
ADD ./scripts/setup-orms.sh /usr/local/bin
RUN sudo chown cynthia:cynthia -R $HOME/.config
RUN bash -c "virtualenv -p python3 $HOME/.env && \
source $HOME/.env/bin/activate && \
pip install mysqlclient psycopg2 sqlacodegen pyodbc django-mssql-backend && \
setup-orms.sh --django-version latest \
--sqlalchemy-version latest --peewee-version latest"
ADD ./examples ${HOME}/cynthia_src/examples
ADD ./entrypoint/entrypoint.sh /usr/local/bin/
# Set the locale
RUN sudo sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
sudo locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
USER cynthia
WORKDIR ${HOME}
ENTRYPOINT ["entrypoint.sh"]