This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
49 lines (38 loc) · 1.7 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
FROM python:2.7.9
MAINTAINER Ariel Núñez<[email protected]>
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# This section is borrowed from the official Django image but adds GDAL and others
RUN apt-get update && apt-get install -y \
gcc \
gettext \
postgresql-client libpq-dev \
sqlite3 \
python-gdal python-psycopg2 \
python-imaging python-lxml \
python-dev libgdal-dev \
python-ldap \
libmemcached-dev libsasl2-dev zlib1g-dev \
python-pylibmc \
--no-install-recommends && rm -rf /var/lib/apt/lists/*
COPY wait-for-postgres.sh /usr/bin/wait-for-postgres
RUN chmod +x /usr/bin/wait-for-postgres
# Upgrade pip
RUN pip install --upgrade pip
# To understand the next section (the need for requirements.txt and setup.py)
# Please read: https://packaging.python.org/requirements/
# python-gdal does not seem to work, let's install manually the version that is
# compatible with the provided libgdal-dev
RUN pip install GDAL==1.10 --global-option=build_ext --global-option="-I/usr/include/gdal"
# Copy the requirements first to avoid having to re-do it when the code changes.
# Requirements in requirements.txt are pinned to specific version
# usually the output of a pip freeze
COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r requirements.txt
# Update the requirements from the local env in case they differ from the pre-built ones.
ONBUILD COPY requirements.txt /usr/src/app/
ONBUILD RUN pip install --no-cache-dir -r requirements.txt
ONBUILD COPY . /usr/src/app/
ONBUILD RUN pip install --no-deps --no-cache-dir -e /usr/src/app/
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]