-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (41 loc) · 1.45 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
# Dockerfile for building out django base packages with all objects and modules
# enabled from the base image.
#Set the base image
FROM ubuntu:latest
# Maintainers name
MAINTAINER Nael Mohammad
# Local directory with project source
ENV DOCKYARD_SRC=django
# Directory in container for all proejct files to make modifications.
ENV DOCKYARD_SRVHOME=/srv
# Directory for project source files.
ENV DOCKYARD_SRVPROJ=/srv/django
# Create a virtualenv to isolate our package dependencies locally
virtualenv env
source env/bin/activate
# Update default repository and packages
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y python python-pip
# Install Django and Django REST framework into the virtualenv
pip install django
pip install djangorestframework
#Create application subdirectory
WORKDIR $DOCYARD_SRVHOME
RUN mkdir media static logs
VOLUME ["$DOCKYARD_SRVHOME/media/", "$DOCKYARD_SRVHOME/logs/"]
# Copy source code to SRCDIR which is the source directory
COPY $DOCKYARD_SRC $DOCKYARD_SRVPROJ
#Install Python dependencies
RUN pip install -r $DOCKYARD_SRVPROJ/requirements.txt
# Port to expose
EXPOSE 8000
# Copy Entrypoint Script into the image
WORKDIR $DOCKYARD_SRVPROJ
COPY ./docker-entrpoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
RUN django-admin.py startproject tutorial
RUN cd tutorial
RUN django-admin.py startapp quickstart
RUN cd ..
RUN python manage.py migrate
RUN python manage.py createsuperuser # default admin user with passwords