60 lines
1.6 KiB
Docker
60 lines
1.6 KiB
Docker
FROM ubuntu:18.04
|
|
|
|
RUN set -ex; \
|
|
apt-get update; \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
python3 python3-pip uwsgi uwsgi-plugin-python3 nginx postgresql-10 postgresql-client-10; \
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
locale-gen en_US.UTF-8;
|
|
|
|
# Configure Postgresql
|
|
RUN set -ex; \
|
|
pg_conftool set lc_messages 'en_US.UTF-8'; \
|
|
pg_conftool set lc_monetary 'en_US.UTF-8'; \
|
|
pg_conftool set lc_numeric 'en_US.UTF-8'; \
|
|
pg_conftool set lc_time 'en_US.UTF-8'; \
|
|
pg_conftool set listen_addresses '';
|
|
COPY pg_hba.conf /etc/postgresql/10/main
|
|
|
|
ENV LANG en_US.UTF-8
|
|
VOLUME /var/lib/postgresql/10/main
|
|
|
|
# Create users and a group for the Django apps.
|
|
# Their home dir does not contain the web files; they are in /var/www/{appname}
|
|
RUN set -ex; \
|
|
groupadd django; \
|
|
useradd -g django --no-user-group -m -d /home/mydata mydata; \
|
|
useradd -g django --no-user-group -m -d /home/opendata opendata
|
|
|
|
# Configure uWSGI
|
|
COPY uwsgi/mydata.ini /etc/uwsgi/apps-available
|
|
RUN set -ex; \
|
|
cd /etc/uwsgi/apps-enabled; \
|
|
ln -s ../apps-available/*.ini .
|
|
|
|
# Set up the virtualenvs
|
|
RUN pip3 install pipenv
|
|
# This creates the Virtualenv inside {project}/.venv
|
|
ENV PIPENV_VENV_IN_PROJECT=1
|
|
COPY deploy/ /var/www/
|
|
WORKDIR /var/www/mydata
|
|
RUN pipenv install --deploy
|
|
# WORKDIR /var/www/opendata
|
|
# RUN pipenv install --deploy
|
|
|
|
# RUN python manage.py collectstatic --noinput
|
|
#
|
|
# RUN npm install --ignore-optional
|
|
# RUN npm run build
|
|
#
|
|
# VOLUME /code/assets
|
|
|
|
|
|
VOLUME /var/log
|
|
|
|
COPY entrypoint.sh /
|
|
# ENTRYPOINT ./entrypoint.sh
|
|
|
|
EXPOSE 80
|
|
WORKDIR /
|