This repository has been archived by the owner on Nov 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (54 loc) · 2.07 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
FROM python:3.8-slim
EXPOSE 4000
# Create folder and user
RUN adduser ambnum && \
chmod 777 /home/ambnum && \
chown ambnum:ambnum /home/ambnum
# update package repositories
RUN apt-get update -y
RUN apt-get install -y python3-pip python3-numpy
RUN pip install --upgrade pip setuptools wheel numpy
# install common useful libs for debugging
RUN apt-get install -y nano git
# install lib to prevent error "spawn ps ENOENT" when launching docker
RUN apt-get install -y procps
# install libs to use within the processor
RUN apt-get install -y jq
# install specific version of node
RUN apt-get install -y curl \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
&& npm i -g yarn
# install code
WORKDIR /home/ambnum
ENV NODE_ENV=production
ENV NODE_OPTIONS='--max_old_space_size=4096'
## install all packages even with dev dependencies to be able to launch typescript build
COPY package.json /home/ambnum
COPY yarn.lock /home/ambnum
RUN yarn
# install microservice code
COPY . /home/ambnum/
# For local build until I understand how to make a conditional RUN in docker
# COPY ./$ENV_FILE /home/ambnum/.env.production
RUN yarn build
RUN chmod 777 /home/ambnum/build && \
chown ambnum:ambnum /home/ambnum/build
RUN pip install social-networks-bot-finder==1.2.3
# this next line is here to break the build in case botfinder does not work
RUN botfinder -v
# clean
RUN apt-get clean autoclean && \
pip cache purge && \
yarn cache clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN chown -R ambnum:ambnum /home/ambnum
# Finally use right user
USER ambnum
WORKDIR /home/ambnum
# and install scraper for this user specifically as it does not work else
# RUN pip3 install --user --upgrade "git+https://github.com/ambanum/twint.git@origin/master#egg=twint"
# use this commit as next breaks with missing 1 required positional argument: 'thumbnailUrl'
RUN pip3 install git+https://github.com/JustAnotherArchivist/snscrape.git@a192dc62368685fe4cd2229ab93a0babf8ad901a
ENV PATH="/home/ambnum/.local/bin:${PATH}"
CMD [ "yarn", "start" ]