forked from opendatacube/datacube-alchemist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (45 loc) · 1.64 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
FROM opendatacube/geobase:wheels as env_builder
ARG py_env_path=/env
COPY requirements.txt /tmp
RUN env-build-tool new /tmp/requirements.txt ${py_env_path}
ENV PATH=${py_env_path}/bin:$PATH
# Copy source code and install it
RUN mkdir -p /code
WORKDIR /code
ADD . /code
RUN pip install .
# Build the production runner stage from here
FROM opendatacube/geobase:runner
ENV LC_ALL=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive \
SHELL=bash
COPY --from=env_builder /env /env
ENV PATH=/env/bin:$PATH
# Environment can be whatever is supported by setup.py
# so, either deployment, test
ARG ENVIRONMENT=deployment
RUN echo "Environment is: $ENVIRONMENT"
# Do the apt install process, including more recent Postgres/PostGIS
RUN apt-get update && apt-get install -y wget gnupg \
&& rm -rf /var/lib/apt/lists/*
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" \
>> /etc/apt/sources.list.d/postgresql.list
RUN apt-get update \
&& apt-get install -y \
postgresql-11 \
git \
&& rm -rf /var/lib/apt/lists/*
# Set up a nice workdir, and only copy the things we care about in
ENV APPDIR=/code
RUN mkdir -p $APPDIR
WORKDIR $APPDIR
ADD . $APPDIR
# These ENVIRONMENT flags make this a bit complex, but basically, if we are in dev
# then we want to link the source (with the -e flag) and if we're in prod, we
# want to delete the stuff in the /code folder to keep it simple.
RUN if [ "$ENVIRONMENT" = "deployment" ] ; then rm -rf $APPDIR ; \
else pip install --editable .[$ENVIRONMENT] ; \
fi
CMD ["datacube-alchemist", "--help"]