-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
52 lines (40 loc) · 1.68 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
# Documentation: https://docs.google.com/document/d/1l6WqJeAJ5oEI_M1axphUslyx-WLBywksv4HliWn78Dw/edit?usp=sharing
FROM postgres:12.2
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH=/venv/bin/:$PATH
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV ENVIRONMENT=docker
ENV FLASK_APP=app.py
ENV FLASK_ENV=development
RUN apt update -y && \
apt-get install -y python-pip && \
apt-get install -y git && \
apt-get install -y python3-dev && \
apt-get install -y python3-venv && \
apt-get install -y postgresql && \
apt-get install -y python-psycopg2 && \
apt-get install -y libpq-dev && \
apt-get install -y vim
COPY ./requirements.txt /app/requirements.txt
RUN python3 -m venv venv && \
. venv/bin/activate && \
python3 -m pip install wheel && \
python3 -m pip install -r ./app/requirements.txt
COPY . /app
WORKDIR /app
RUN python3 -m venv venv && \
. venv/bin/activate && \
export FLASK_APP=app.py && \
export ENVIRONMENT=development
USER root
RUN useradd invisible_flow_testing; echo "invisible_flow_testing:password"|chpasswd;
USER postgres
CMD initdb; pg_ctl -D /var/lib/postgresql/data start; createdb; echo "create user invisible_flow WITH login;" | psql; \
echo "create user invisible_flow_testing WITH login;" | psql; echo "ALTER ROLE invisible_flow_testing SUPERUSER" | psql; \
echo "CREATE DATABASE invisible_flow_testing;" | psql; echo "GRANT ALL PRIVILEGES ON DATABASE invisible_flow_testing TO invisible_flow_testing;" | psql; \
service postgresql start; \
python3 manage.py db upgrade --directory invisible_flow/migrations; \
echo "password" | su invisible_flow_testing; \
cd invisible_flow; \
flask run --host=0.0.0.0 --port=$PORT