forked from HumanSignal/label-studio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
56 lines (40 loc) · 1.55 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
# syntax=docker/dockerfile:1.3
FROM node:14 AS frontend-builder
ENV NPM_CACHE_LOCATION=/root/.npm
WORKDIR /label-studio/label_studio/frontend
COPY label_studio/frontend .
COPY label_studio/__init__.py /label-studio/label_studio/__init__.py
RUN --mount=type=cache,target=$NPM_CACHE_LOCATION \
npm ci \
&& npm run build:production
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive \
LS_DIR=/label-studio \
PIP_CACHE_DIR=/.cache \
DJANGO_SETTINGS_MODULE=core.settings.label_studio \
LABEL_STUDIO_BASE_DATA_DIR=/label-studio/data \
SETUPTOOLS_USE_DISTUTILS=stdlib
WORKDIR $LS_DIR
# install packages
RUN set -eux \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
build-essential postgresql-client libmysqlclient-dev mysql-client python3.8 python3-pip python3.8-dev \
uwsgi git libxml2-dev libxslt-dev zlib1g-dev
# Copy and install middleware dependencies
COPY deploy/requirements-mw.txt .
RUN --mount=type=cache,target=$PIP_CACHE_DIR \
pip3 install -r requirements-mw.txt
# Copy and install requirements.txt first for caching
COPY deploy/requirements.txt .
RUN --mount=type=cache,target=$PIP_CACHE_DIR \
pip3 install -r requirements.txt
COPY . .
RUN --mount=type=cache,target=$PIP_CACHE_DIR \
pip3 install -e .
RUN rm -rf ./label_studio/frontend
COPY --from=frontend-builder /label-studio/label_studio/frontend/dist ./label_studio/frontend/dist
RUN python3 label_studio/manage.py collectstatic --no-input
EXPOSE 8080
ENTRYPOINT ["./deploy/docker-entrypoint.sh"]
CMD ["label-studio"]