forked from WHOIGit/ifcbdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (39 loc) · 1.33 KB
/
Dockerfile
File metadata and controls
51 lines (39 loc) · 1.33 KB
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
# ------------------------ BUILD ----------------------- #
FROM python:3.9-slim-bullseye AS builder
# Install build requirements
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
libgdal-dev
# Create and activate a Python virtual environment
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install Python requirements
COPY requirements.txt .
# setuptools<58 needed to fix gdal<3.3 issue https://github.com/pypa/setuptools/issues/2781
RUN pip install -U pip \
&& pip install 'setuptools<58.0.0' \
&& pip install -r requirements.txt \
&& git clone https://github.com/veot/pyifcb \
&& pip install ./pyifcb
# ------------------------ RUN ------------------------ #
FROM python:3.9-slim-bullseye
# Install some GDAL requirements
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
libgdal28 \
&& rm -rf /var/lib/apt/lists/*
# Copy production ready venv from builder
ENV VIRTUAL_ENV="/opt/venv"
COPY --from=builder $VIRTUAL_ENV $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Create and switch to a non-root user
RUN useradd --create-home appuser
USER appuser
# Copy Django project
WORKDIR /home/appuser/ifcbdb
COPY ifcbdb .
EXPOSE 8000
CMD gunicorn --bind :8000 ifcbdb.wsgi:application