-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
62 lines (45 loc) · 2.36 KB
/
dockerfile
File metadata and controls
62 lines (45 loc) · 2.36 KB
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
61
62
##
## Dockerfile to generate a Docker image from a GeoDjango project
##
## Start from an existing image with Miniconda installed
FROM continuumio/miniconda3
MAINTAINER Mark Foley
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE=AWM.settings
## Ensure that everything is up-to-date
RUN apt-get -y update && apt-get -y upgrade
RUN conda update -n base conda && conda update -n base --all
## Make a working directory in the image and set it as working dir.
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
## UPDATE: these are not necessary as conda gets whatever it needs anyway.
## Get the following libraries. We can install them "globally" on the image as it will contain only our project
#RUN apt-get -y install build-essential python-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
## You should have already exported your conda environment to an "ENV.yml" file.
## Now copy this to the image and install everything in it. Make sure to install a WSGI server - it may not be in the source
## environment.
COPY ENV.yml /usr/src/app
RUN conda env create -n AWM --file ENV.yml
## Make RUN commands use the new environment
## See https://pythonspeed.com/articles/activate-conda-dockerfile/ for explanation
RUN echo "conda activate AWM" >> ~/.bashrc
SHELL ["/bin/bash", "--login", "-c"]
## Set up conda to match our test environment
RUN conda config --add channels conda-forge && conda config --set channel_priority strict
RUN cat ~/.condarc
## Install the appropriate WSGI server. If ccoming from Linux or Macc, this will probably be already there. If coming
## from MS Windows, you'll need to install it here.
#RUN conda install uwsgi
RUN conda install gunicorn
## Copy everything in your Django project to the image and display a directory listing.
COPY . /usr/src/app
RUN ls -la
## Make sure that static files are up to date and available.
RUN python manage.py collectstatic --no-input
## Expose port on the image. We'll map a localhost port to this later. You can change this if desired.
EXPOSE 8002
## Run a WSGI server - "uwsgi" or "gunicorn". uWSGI is a Web Server Gateway Interface (WSGI) server implementation
## that is typically used to run Python web applications. Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX.
## It is an alternative to uWSGI.
#CMD uwsgi --ini uwsgi.ini
CMD gunicorn AWM.wsgi --config gunicorn.conf.py