forked from creativecommons/legaldb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (40 loc) · 1.5 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
# https://docs.docker.com/engine/reference/builder/
# https://hub.docker.com/_/python/
# https://devcenter.heroku.com/articles/getting-started-with-python
# Match version to Heroku app
# Keep in sync with .github/workflows/main.yml and Pipfile
FROM python:3.10
# Configure apt not to prompt during docker build
ARG DEBIAN_FRONTEND=noninteractive
# Python: disable bytecode (.pyc) files
# https://docs.python.org/3.9/using/cmdline.html
ENV PYTHONDONTWRITEBYTECODE=1
# Python: force the stdout and stderr streams to be unbuffered
# https://docs.python.org/3.9/using/cmdline.html
ENV PYTHONUNBUFFERED=1
# Python: enable faulthandler to dump Python traceback on catastrophic cases
# https://docs.python.org/3.9/library/faulthandler.html
ENV PYTHONFAULTHANDLER=1
WORKDIR /root
# Configure apt to avoid installing recommended and suggested packages
RUN apt-config dump \
| grep -E '^APT::Install-(Recommends|Suggests)' \
| sed -e's/1/0/' \
| tee /etc/apt/apt.conf.d/99no-recommends-no-suggests
# Resynchronize apt package index
RUN apt-get update
# Install apt package dependencies
RUN apt-get install -y g++ gcc gettext postgresql-server-dev-all
## Install pipenv
RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN pip install --upgrade pipenv
# Install python dependencies
COPY Pipfile .
COPY Pipfile.lock .
RUN pipenv sync --dev --system
# Create mount point for docker-compose volume and set as current workdir
WORKDIR /legaldb
# Create non-root user
RUN useradd --create-home --shell /bin/bash user
USER user