-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
52 lines (45 loc) · 1.82 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
############################################################
# Dockerfile to run a Django-based web application
# Based on an AMI
############################################################
# Set the base image to use to Ubuntu
FROM phusion/baseimage:0.9.22
# Set the file maintainer (your name - the file's author)
MAINTAINER Jonathan Anderson
CMD ["/sbin/my_init"]
# Update the default application repository sources list
RUN apt-get update && apt-get -y upgrade \
util-linux=2.27.1-6ubuntu3.2
RUN apt-get install -y python3 python3-pip
RUN apt-get install -y python3-dev
RUN apt-get install -y libmysqlclient-dev
RUN apt-get install -y git
RUN apt-get install -y nginx
# Create application subdirectories
WORKDIR /srv
RUN mkdir media static logs
#read
VOLUME ["/srv/media/", "/srv/logs/"]
# Copy application source code to SRCDIR
COPY ./docker-entrypoint.sh /etc/my_init.d/
RUN ["git", "init"]
RUN ["git", "remote", "add", "origin", "https://github.com/I-sektionen/i-portalen"]
RUN ["git", "fetch", "origin", "master:refs/remotes/origin/master"]
RUN ["git", "checkout", "-t", "origin/master"]
RUN rm -f /etc/service/nginx/down &&\
rm /etc/nginx/sites-enabled/default
# Install Python dependencies
#RUN pip3 $DOCKYARD_SRVPROJ/requirement.txt
# Port to expose
EXPOSE 80
# Copy entrypoint script into the image
#RUN /usr/bin/pip3 install --upgrade pip
RUN /usr/bin/pip3 install -r requirements.txt
RUN /usr/bin/pip3 install gunicorn
RUN ["cp", "./django_nginx.conf", "/etc/nginx/sites-available/"]
#COPY ./django_nginx_local.conf /etc/nginx/sites-available/django_nginx.conf
RUN ["chmod", "+x", "/etc/my_init.d/docker-entrypoint.sh"]
WORKDIR /srv/wsgi
RUN ln -s /etc/nginx/sites-available/django_nginx.conf /etc/nginx/sites-enabled
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*