forked from PUNCH-Cyber/YaraGuardian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
53 lines (46 loc) · 1.55 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
FROM ubuntu:16.04
MAINTAINER Adam Trask ”adam@punchcyber.com”
ENV LANG='C.UTF-8' LC_ALL='C.UTF-8' LANGUAGE='C.UTF-8' NODE_VERSION='8.0.0'
ENV API_DIR='/usr/local/YaraGuardian' API_USER='YaraManager' API_GROUP='YaraManager'
ADD . ${API_DIR}
RUN apt-get update \
&& apt-get -y install software-properties-common \
&& apt-add-repository -y multiverse \
&& apt-get update \
&& apt-get upgrade -y \
&& echo "Installing prerequisite packages..." \
&& apt-get -y install \
curl \
git \
libpq-dev \
npm \
python3 \
python3-dev \
python3-setuptools \
&& easy_install3 pip \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
############################
### Install Dependencies ###
############################
WORKDIR ${API_DIR}
RUN echo "Installing NodeJS version ${NODE_VERSION}" \
&& npm cache clean -f \
&& npm install -g n \
&& n ${NODE_VERSION} \
&& ln -sf /usr/local/n/versions/node/${NODE_VERSION}/bin/node /usr/bin/node \
&& echo "Installing python requirements..." \
&& pip3 install pipenv \
&& pipenv install --deploy --system \
&& echo "Installing front-end components" \
&& npm install yarn -g \
&& yarn \
&& yarn webpack \
&& python3 manage.py collectstatic --noinput \
&& rm -rf /usr/local/n
RUN groupadd -r ${API_USER} \
&& useradd -r -g ${API_GROUP} ${API_USER} \
&& chown -R ${API_USER}:${API_GROUP} ${API_DIR}
EXPOSE 8080
USER ${API_USER}
CMD PYTHONUNBUFFERED=1 gunicorn -k gevent --bind=0.0.0.0:8080 --access-logfile - --error-logfile - YaraGuardian.wsgi:application