This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
70 lines (53 loc) · 2.54 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
70
FROM python:3.8-slim-bullseye
RUN apt-get update && apt-get --no-install-recommends install --yes curl
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get --no-install-recommends install --yes \
libaio1 libaio-dev xmlsec1 libffi-dev libsasl2-dev \
build-essential default-libmysqlclient-dev git netcat \
nodejs
WORKDIR /tmp/
COPY requirements.txt /tmp/
RUN pip install -r requirements.txt && \
pip install gunicorn
# Sets the local timezone of the docker image
ENV TZ=America/Detroit
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ARG LOCALHOST_DEV
WORKDIR /usr/src/app/student_explorer/dependencies/
# This is based on here. It seems like it unfortunately may need to be manually updated
# http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/index.html
ENV ORACLE_CLIENT_VERSION=18.5
ENV ORACLE_CLIENT_VERSION_FULL=18.5.0.0.0-3
ENV ORACLE_HOME /usr/lib/oracle/$ORACLE_CLIENT_VERSION/client64
ENV LD_LIBRARY_PATH /usr/lib/oracle/$ORACLE_CLIENT_VERSION/client64/lib
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app/
COPY . /usr/src/app
WORKDIR /tmp/
# Run these only for dev
# Make a python package:
RUN if [ "$LOCALHOST_DEV" ] ; then \
echo "LOCALHOST_DEV is set, building development dependencies" && \
touch /usr/src/app/student_explorer/local/__init__.py && \
# Create default settings_override module:
echo "from student_explorer.settings import *\n\nDEBUG = True" > /usr/src/app/student_explorer/local/settings_override.py && \
apt-get --no-install-recommends install --yes default-mysql-client && \
pip install coverage \
; else \
echo "LOCALHOST_DEV is not set, building production (Oracle) dependencies" && \
# Converted to Debian format
apt-get install --yes alien && \
curl -sO https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient${ORACLE_CLIENT_VERSION}-basiclite-${ORACLE_CLIENT_VERSION_FULL}.x86_64.rpm && \
alien oracle-instantclient*.rpm && \
dpkg -i *.deb && rm *.deb *.rpm && \
pip install cx_Oracle==7.0 \
; fi
WORKDIR /usr/src/app/
# Compile the css file
RUN pysassc seumich/static/seumich/styles/main.scss seumich/static/seumich/styles/main.css
RUN npm install
# This is needed to clean up the examples files as these cause collectstatic to fail (and take up extra space)
RUN find node_modules -type d -name "examples" -print0 | xargs -0 rm -rf
RUN python manage.py collectstatic --settings=student_explorer.settings --noinput --verbosity 0
EXPOSE 8000
CMD ./start.sh