forked from bluesky/tiled
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (49 loc) · 2.11 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
FROM node:16-alpine AS web_frontend_builder
WORKDIR /code
COPY web-frontend .
RUN npm install && npm run build
# We cannot upgrade to Python 3.11 until numba supports it.
# The `sparse` library relies on numba.
FROM python:3.10-slim as builder
# We need git at build time in order for versioneer to work, which in turn is
# needed for the server to correctly report the library_version in the /api/v1/
# route.
RUN apt-get -y update && apt-get install -y git
WORKDIR /code
# Ensure logs and error messages do not get stuck in a buffer.
ENV PYTHONUNBUFFERED=1
# Use a venv to avoid interfering with system Python.
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
# This is equivalent to `source $VIRTUAL_ENV/bin/activate` but it
# persists into the runtime so we avoid the need to account for it
# in ENTRYPOINT or CMD.
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Copy requirements over first so this layer is cached and we don't have to
# reinstall dependencies when only the tiled source has changed.
COPY requirements-server.txt requirements-formats.txt requirements-dataframe.txt requirements-array.txt requirements-xarray.txt requirements-sparse.txt requirements-compression.txt /code/
RUN pip install --upgrade --no-cache-dir pip wheel
RUN pip install --upgrade --no-cache-dir \
-r /code/requirements-array.txt \
-r /code/requirements-compression.txt \
-r /code/requirements-dataframe.txt \
-r /code/requirements-formats.txt \
-r /code/requirements-server.txt \
-r /code/requirements-sparse.txt \
-r /code/requirements-xarray.txt
COPY --from=web_frontend_builder /code/build /code/share/tiled/ui
COPY . .
# note requirements listed here but all deps should be already satisfied
RUN pip install '.[array, compression, dataframe, formats, server, sparse, xarray]'
# FROM base as test
#
# RUN pip install '.[client]'
# RUN pip install -r requirements-dev.txt
# RUN pytest -v
FROM python:3.10-slim as runner
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=builder $VIRTUAL_ENV $VIRTUAL_ENV
WORKDIR /deploy
EXPOSE 8000
CMD ["tiled", "serve", "config", "--host", "0.0.0.0", "--port", "8000", "--scalable"]