|
1 |
| -FROM ubuntu |
| 1 | +FROM python:3.7-slim |
2 | 2 |
|
3 |
| -ENV DEBIAN_FRONTEND noninteractive |
4 |
| -RUN apt-get update && apt-get install -y postgresql python3 python3-pip wget unzip sudo |
| 3 | +RUN apt update && apt install -y wget > /dev/null && rm -rf /var/lib/apt/lists/* \ |
| 4 | + && rm /bin/sh && ln -s /bin/bash /bin/sh \ |
| 5 | + && groupadd -r user && useradd --create-home --no-log-init -r -g user user \ |
| 6 | + && mkdir /proxy_py && chown user:user /proxy_py |
5 | 7 |
|
6 |
| -USER postgres |
7 |
| -RUN /etc/init.d/postgresql start && \ |
8 |
| - createuser proxy_py && \ |
9 |
| - createdb proxy_py && \ |
10 |
| - psql -c "alter user proxy_py with encrypted password 'proxy_py';" && \ |
11 |
| - psql -c "grant all privileges on database proxy_py to proxy_py;" && \ |
12 |
| - cat /etc/postgresql/10/main/pg_hba.conf | \ |
13 |
| - sed -e "s/local all all peer/local all all md5/" | \ |
14 |
| - tee /etc/postgresql/10/main/pg_hba.conf && \ |
15 |
| - /etc/init.d/postgresql stop |
| 8 | +WORKDIR /proxy_py |
| 9 | +USER user |
| 10 | +# TODO: change to master |
| 11 | +ARG VERSION=dockerizing |
16 | 12 |
|
17 |
| -USER root |
18 |
| -RUN wget https://github.com/DevAlone/proxy_py/archive/v2.2.zip -O master.zip 2> /dev/null |
19 |
| -RUN unzip master.zip; rm master.zip; mv proxy_py-* proxy_py; cd proxy_py |
20 |
| -WORKDIR proxy_py |
21 |
| -RUN pip3 install -r requirements.txt |
22 |
| -RUN cp config_examples/settings.py /proxy_py/proxy_py/ |
| 13 | +RUN wget https://github.com/DevAlone/proxy_py/archive/$VERSION.tar.gz -O sources.tar.gz 2> /dev/null \ |
| 14 | + && tar -xf sources.tar.gz && rm sources.tar.gz \ |
| 15 | + && mv proxy_py-*/.[!.]* ./ && mv proxy_py-*/* ./ \ |
| 16 | + && rmdir proxy_py-* \ |
| 17 | + && python3 -m venv env |
| 18 | + |
| 19 | +RUN cp config_examples/settings.py proxy_py/settings.py |
| 20 | +RUN source ./env/bin/activate && pip3 install -r requirements.txt --no-cache-dir |
23 | 21 |
|
24 | 22 | EXPOSE 55555
|
25 |
| -CMD /etc/init.d/postgresql start; python3 main.py |
| 23 | +CMD ./run.sh |
0 commit comments