-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
63 lines (48 loc) · 1.3 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
58
59
60
61
62
63
# Based on best practices from Snyk: https://snyk.io/blog/best-practices-containerizing-python-docker/
# It builds the container in two steps for maximum caching
################
# DEPENDENCIES #
################
FROM python:3.8 as deps
# Install missing dependencies
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
libxml2 \
libxmlsec1 \
libxmlsec1-dev
# Disable pip version check
ENV PIP_DISABLE_PIP_VERSION_CHECK 1
# Set work directory
WORKDIR /bluebottle
# Create the env (for caching)
RUN python -m venv /bluebottle/venv
ENV PATH="/bluebottle/venv/bin:$PATH"
# Copy files necessary for install
RUN mkdir bluebottle
COPY bluebottle/__init__.py ./bluebottle
COPY ["README.rst", "setup.py", "./"]
# Install any (missing) requirements
RUN pip install -e .[env]
################
# BLUEBOTTLE #
################
FROM python:3.8
# Install missing dependencies
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
postgresql \
postgis
# Don't write .pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# Console output is not buffered by Docker
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /bluebottle
# Copy files
COPY --from=deps /bluebottle/venv ./venv
COPY . .
# Set the env
ENV PATH="/bluebottle/venv/bin:$PATH"
# Keep bash history
#
ENV HISTFILE="/opt/data/.bash_history"