Skip to content

Commit

Permalink
Fix docker deployment (#166)
Browse files Browse the repository at this point in the history
* Docker fix

* Update docker build script
  • Loading branch information
imWildCat authored Mar 6, 2022
1 parent a711ef7 commit 17e6808
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
44 changes: 26 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
FROM node:lts-buster as node-build

WORKDIR /root

COPY package.json .
RUN yarn install
COPY . .
RUN make assets-build

FROM ubuntu:focal as python-build

FROM python:3.9-slim as python-build
RUN apt-get update && apt-get install -y g++ gcc libxslt-dev make libcurl4-openssl-dev build-essential
RUN apt-get install -y libssl-dev
WORKDIR /root
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles

RUN apt-get update && \
apt-get install -y python3 python3-distutils libpython3.8-dev curl g++ gcc libxslt-dev make libcurl4-openssl-dev build-essential libssl-dev && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py && \
rm get-pip.py && \
# Feature-parity with node.js base images.
apt-get install -y --no-install-recommends git openssh-client && \
# clean apt cache
rm -rf /var/lib/apt/lists/* && \
# Create the pwuser
adduser pwuser

WORKDIR /app

COPY --from=node-build /root/scylla/assets ./scylla/assets
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN python -m playwright install chromium
RUN pip3 install -r requirements.txt
COPY . .
RUN python setup.py install
RUN python3 setup.py install

FROM python:3.9-slim as prod

LABEL maintainer="WildCat <[email protected]>"

RUN apt-get update && apt-get install -y libxslt-dev libssl-dev libcurl4-openssl-dev

COPY --from=python-build /usr/local/lib/python3.9/site-packages/ /usr/local/lib/python3.9/site-packages/
COPY --from=python-build /root/.cache/ms-playwright /root/.cache/ms-playwright

WORKDIR /var/www/scylla
RUN mkdir -p /var/www/scylla
VOLUME /var/www/scylla

RUN python3 -m playwright install chromium --with-deps

EXPOSE 8899
EXPOSE 8081

CMD python -m scylla
CMD python3 -m scylla --db-path /var/www/scylla/scylla.db
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ sanic==21.6.2
sanic-cors
schedule==1.1.0
six==1.16.0
playwright==1.13.1
playwright==1.19.1
pyquery==1.4.3
14 changes: 10 additions & 4 deletions scylla/providers/proxy_list_provider.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import base64
import re
from typing import List

from pyquery import PyQuery

Expand All @@ -14,14 +15,19 @@ def __init__(self):
super().__init__()
self.w = Worker()

def parse(self, document: PyQuery) -> [ProxyIP]:
ip_list: [ProxyIP] = []
def parse(self, document: PyQuery) -> List[ProxyIP]:
ip_list: List[ProxyIP] = []

if document is None:
return []

for ul in document.find('#proxy-table > div.table-wrap ul'):
js_code = ul.find('li.proxy script').text()
js_code_element = ul.find('li.proxy script')

if not js_code_element:
return []

js_code = js_code_element.text()
matched = re.findall(r"Proxy\('(.+)'\)", js_code)
if matched and len(matched) > 0:
encoded = matched[0]
Expand All @@ -32,7 +38,7 @@ def parse(self, document: PyQuery) -> [ProxyIP]:

return ip_list

def urls(self) -> [str]:
def urls(self) -> List[str]:
ret = []
first_url = 'http://proxy-list.org/english/index.php?p=1'
first_page = self.w.get_html(first_url, False)
Expand Down

0 comments on commit 17e6808

Please sign in to comment.