-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (45 loc) · 1.5 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
FROM ubuntu:focal
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv nginx supervisor curl libpq-dev jq
RUN apt-get install -y binutils libproj-dev gdal-bin
# Setup python 3 virtualenv
RUN mkdir /envs/
RUN python3 -m venv /envs/data_hub
ENV PATH /envs/data_hub/bin:$PATH
# upgrade pip
RUN pip3 install -U pip
RUN python3 --version
RUN pip3 --version
# install wheel
RUN pip3 install wheel
# set aws region
ENV AWS_REGION us-east-1
COPY /docker-entrypoint.sh /
COPY /docker-entrypoint.d/* /docker-entrypoint.d/
ONBUILD COPY /docker-entrypoint.d/* /docker-entrypoint.d/
RUN chmod +x docker-entrypoint.sh
RUN chmod +x docker-entrypoint.d/*.sh
# Setup app
COPY src /src/
RUN pip3 install -r /src/requirements.txt
RUN pip3 install gunicorn
# install awscli
RUN pip3 install awscli --upgrade
# Setup Django environment
ENV PYTHONPATH $PYTHONPATH: /src/data_hub
ENV DJANGO_SETTINGS_MODULE data_hub.production_settings
# Setup staticfiles
RUN chmod -R 777 /src/data_hub/static
# Setup nginx
RUN rm /etc/nginx/sites-enabled/default
COPY django.conf /etc/nginx/sites-available/
RUN ln -s /etc/nginx/sites-available/django.conf /etc/nginx/sites-enabled/django.conf
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Setup supervisord
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY gunicorn.conf /etc/supervisor/conf.d/gunicorn.conf
# Expose port
EXPOSE 1969
# Run entrypoint script
ENTRYPOINT ["/docker-entrypoint.sh"]