-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
48 lines (38 loc) · 1.25 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
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c) 2020-2023, The Chancellor, Masters and Scholars of the University
# of Oxford, and the 'Galv' Developers. All rights reserved.
ARG PYTHON_VERSION=3.10-slim-bullseye
FROM python:${PYTHON_VERSION}
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE config.settings
# Install postgresql-client for healthchecking
# install psycopg2 dependencies.
# Install NGINX for file serving
# We can't use WhiteNoise because we need to use xAccelRedirect to allow Django to verify permissions on files
RUN apt-get update && apt-get install -y \
postgresql-client \
build-essential libssl-dev libffi-dev python3-dev python-dev \
libpq-dev \
gcc \
nginx \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /code
RUN mkdir -p /galv_files/static
RUN mkdir -p /galv_files/media
RUN mkdir -p /galv_files/data
RUN mkdir -p /var/log/galv
WORKDIR /code
COPY requirements.txt /tmp/requirements.txt
RUN set -ex && \
pip install --upgrade pip && \
pip install -r /tmp/requirements.txt && \
rm -rf /root/.cache/
COPY . /code
RUN chmod +x /code/*.sh
# For NGINX
COPY nginx.conf /etc/nginx/nginx.conf
RUN nginx -t
EXPOSE 80
WORKDIR /code/backend_django
ENTRYPOINT ["/code/server.sh"]