This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathDockerfile
69 lines (57 loc) · 1.64 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
FROM ubuntu:16.04
MAINTAINER Hang Park <[email protected]>
# Install packages
RUN apt-get update \
&& apt-get install -y \
gcc \
python3.5-dev \
mysql-client \
nginx \
python-virtualenv \
npm \
nodejs-legacy \
git \
netcat \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Configure Nginx
WORKDIR /etc/nginx/sites-available
ADD nginx.conf kaistusc
WORKDIR /etc/nginx/sites-enabled
RUN rm default \
&& ln -s ../sites-available/kaistusc ./kaistusc \
&& echo "\ndaemon off;" >> /etc/nginx/nginx.conf
# Configure uWSGI
RUN mkdir -p /tmp/uwsgi
# Download frontend dependencies
WORKDIR /app/kaistusc
ADD package.json package.json
ADD bower.json bower.json
RUN npm install \
&& node_modules/bower/bin/bower install --allow-root
# Set python virtual environment
WORKDIR /app/kaistusc
RUN mkdir -p /app/kaistusc
ADD requirements.txt requirements.txt
RUN virtualenv --python=python3 venv \
&& /bin/bash -c "source venv/bin/activate && pip install -r requirements.txt"
# Add whole project
WORKDIR /app/kaistusc
ADD ./ ./
# Compile and collect static files
WORKDIR /app/kaistusc
RUN node_modules/gulp/bin/gulp.js \
&& /bin/bash -c "source venv/bin/activate && python manage.py collectstatic --noinput"
# Compile document
WORKDIR /app/kaistusc/docs
RUN /bin/bash -c "source ../venv/bin/activate && make html"
# Configure production mode
WORKDIR /app/kaistusc
RUN sed -i "s/DEBUG = True/DEBUG = False/g" kaistusc/settings.py
# Configure server encoding
ENV LANG C.UTF-8
# Expose ports
EXPOSE 80 443
# Run server
RUN chmod +x /app/kaistusc/docker-entrypoint.sh
ENTRYPOINT /app/kaistusc/docker-entrypoint.sh