-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
48 lines (39 loc) · 1.32 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
FROM python:3.9-slim
# Install missing libs
RUN apt-get update \
&& apt-get install -y curl libpq-dev gcc python3-cffi git && \
apt-get clean autoclean && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/cache/apt/archives/*.deb
# Creating Application Source Code Directory
RUN mkdir -p /usr/app
# Setting Home Directory for containers
WORKDIR /usr/app
# Installing python dependencies
COPY requirements.txt /usr/app
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install gunicorn
# Cleanup
RUN rm -rf /var/lib/apt/lists/*
RUN rm -rf /root/.cache/*
RUN rm -rf /tmp/*
RUN apt-get -y autoremove --purge && apt-get -y autoclean && apt-get -y clean
RUN rm -rf /usr/share/man/*
RUN rm -rf /usr/share/doc/*
RUN find /var/lib/apt -type f | xargs rm -f
RUN find /var/cache -type f -exec rm -rf {} \;
RUN find /var/log -type f | while read f; do echo -ne '' > $f; done;
# Copying src code to Container
COPY . /usr/app
RUN pip install --no-cache-dir -r requirements.txt
# Exposing Ports
EXPOSE 8000
# Environemnt variables
ENV DJANGO_ENV development
ENV GUNICORN_BIND 0.0.0.0:8000
ENV GUNICORN_WORKERS 4
ENV GUNICORN_WORKERS_CONNECTIONS 1001
# Running Python Application
CMD sh docker-startup.sh
#CMD gunicorn --workers=${GUNICORN_WORKERS} config.wsgi:application -b ${GUNICORN_BIND} --log-level info