-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
69 lines (54 loc) · 2.22 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
57
58
59
60
61
62
63
64
65
66
67
68
69
# The first instruction is what image we want to base our container on
# We Use an official Python runtime as a parent image
FROM python:3.6
# The enviroment variable ensures that the python output is set straight
# to the terminal with out buffering it first
ENV PYTHONUNBUFFERED 1
# Add Arguments
ARG AWS_ACCESS_KEY_ID_ARG
ARG AWS_SECRET_ACCESS_KEY_ARG
ARG AWS_STORAGE_BUCKET_NAME_ARG
ARG DEBUG_VALUE_ARG
ARG DJANGO_KEY_ARG
ARG TWITTER_CONSUMER_KEY_ARG
ARG TWITTER_CONSUMER_SECRET_ARG
ARG TWITTER_ACCESS_TOKEN_ARG
ARG TWITTER_ACCESS_SECRET_ARG
ARG DATABASE_URL_ARG
# Set Environment Variable
ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID_ARG}
ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY_ARG}
ENV AWS_STORAGE_BUCKET_NAME=${AWS_STORAGE_BUCKET_NAME_ARG}
ENV DEBUG_VALUE=${DEBUG_VALUE_ARG}
ENV DJANGO_KEY=${DJANGO_KEY_ARG}
ENV TWITTER_CONSUMER_KEY=${TWITTER_CONSUMER_KEY_ARG}
ENV TWITTER_CONSUMER_SECRET=${TWITTER_CONSUMER_SECRET_ARG}
ENV TWITTER_ACCESS_TOKEN=${TWITTER_ACCESS_TOKEN_ARG}
ENV TWITTER_ACCESS_SECRET=${TWITTER_ACCESS_SECRET_ARG}
ENV DATABASE_URL=${DATABASE_URL_ARG}
# create root directory for our project in the container
RUN mkdir /TwitterAnalysis
# Copy the current directory contents into the container at /TwitterAnalysis
ADD . /TwitterAnalysis/
# Set the working directory to /TwitterAnalysis/model_setup
WORKDIR /TwitterAnalysis/model_setup
# Install any needed packages specified in setup.py
RUN pip install -e .
# Set the working directory to /TwitterAnalysis/model_setup
WORKDIR /TwitterAnalysis
# Install spacy language model
RUN python -m spacy download en
# Run to create migrations for changes
# RUN python manage.py makemigrations
# Run to create migrations for changes in setiment app
# RUN python manage.py makemigrations sentiment
# Run to apply those changes to the database
# RUN python manage.py migrate
# expose the port 80
EXPOSE 80
# define the default command to run when starting the container using Django
# Uncomment the next two lines to use django to render app and comment gunicorn command
# ENTRYPOINT ["python", "manage.py"]
# CMD ["runserver", "0.0.0.0:8000"]
# define the default command to run when starting the container using gunicorn
CMD ["gunicorn", "--bind", ":80", "TwitterAnalysis.wsgi:application"]