-
Notifications
You must be signed in to change notification settings - Fork 68
/
Dockerfile
57 lines (45 loc) · 1.58 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
# https://docs.docker.com/engine/reference/builder/
# https://hub.docker.com/_/python/
# https://devcenter.heroku.com/articles/python-support
# Match version to Heroku app
# Keep in sync with .github/workflows/main.yml and Pipfile
FROM python:3.12
# 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 the package index and install packages
# https://docs.docker.com/build/building/best-practices/#apt-get
RUN apt-get update \
&& apt-get install -y \
g++ \
gcc \
gettext \
postgresql-server-dev-all \
&& rm -rf /var/lib/apt/lists/*
## Install pipenv
RUN pip install --upgrade \
pip \
setuptools \
pipenv
# Install python dependencies
COPY Pipfile 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