-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
42 lines (35 loc) · 1.44 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
FROM python:3.8
RUN apt-get update -y
RUN apt-get install -y nginx supervisor
# create folder structure similar to the one on production server
RUN mkdir /opt/gugik2osm
RUN mkdir /opt/gugik2osm/app
RUN mkdir /opt/gugik2osm/web
RUN mkdir /opt/gugik2osm/log
WORKDIR /opt/gugik2osm
# copy files to docker and install python libraries
COPY ./requirements.txt ./
RUN python -m venv /opt/gugik2osm/venv
ENV VIRTUAL_ENV /opt/gugik2osm/venv
ENV PATH /opt/gugik2osm/venv/bin:$PATH
RUN pip install --no-cache-dir -r requirements.txt
COPY ./conf/ ./conf/
# create symlinks similar to the ones on production server
RUN ln -sf /opt/gugik2osm/conf/nginx.conf /etc/nginx/sites-available/gugik2osm.conf
RUN ln -sf /opt/gugik2osm/conf/nginx.conf /etc/nginx/sites-enabled/gugik2osm.conf
# remove default dir so we can create a symlink
RUN rm -rf /var/www/html
RUN ln -sf /opt/gugik2osm/web /var/www/html
RUN ln -sf /opt/gugik2osm/conf/supervisord.conf /etc/supervisor/conf.d/gugik2osm.conf
# remove default nginx config
RUN rm /etc/nginx/sites-enabled/default
RUN rm /etc/nginx/sites-available/default
# make directory for socket used by gunicorn
RUN mkdir /run/gugik2osm/
# make directory for overpass layers
RUN mkdir /var/www/overpass-layers/
# create dir for nginx cache
RUN mkdir /tmp/nginx/
# create a script starting services and keeping container running (bash will wait for commands)
RUN echo "supervisord && service nginx restart && bash" > ./start.sh
CMD ["bash", "./start.sh"]