Skip to content

Commit cca4382

Browse files
committed
dockerfiles
1 parent 713a32f commit cca4382

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

Dockerfile

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
FROM ubuntu
1+
FROM python:3.7-slim
22

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
57

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
1612

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
2321

2422
EXPOSE 55555
25-
CMD /etc/init.d/postgresql start; python3 main.py
23+
CMD ./run.sh

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '3'
2+
services:
3+
proxy_py:
4+
build: .
5+
ports:
6+
- "55555:55555"
7+
postgres:
8+
image: "postgres:12"
9+

0 commit comments

Comments
 (0)