forked from HumanSignal/label-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.redhat
70 lines (53 loc) · 2.1 KB
/
Dockerfile.redhat
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
64
65
66
67
68
69
70
# syntax=docker/dockerfile:1.3
FROM registry.access.redhat.com/ubi8/nodejs-14-minimal AS frontend-builder
ENV NPM_CACHE_LOCATION=$HOME/.npm \
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /label-studio/label_studio/frontend
COPY --chown=1001:0 label_studio/frontend .
COPY --chown=1001:0 label_studio/__init__.py /label-studio/label_studio/__init__.py
RUN --mount=type=cache,target=$NPM_CACHE_LOCATION,uid=1001,gid=0 \
npm ci \
&& npm run build:production
FROM registry.access.redhat.com/ubi8/python-39
ENV LS_DIR=/label-studio \
PIP_CACHE_DIR=$HOME/.cache \
DJANGO_SETTINGS_MODULE=core.settings.label_studio \
LABEL_STUDIO_BASE_DATA_DIR=/label-studio/data \
OPT_DIR=/opt/heartex/instance-data/etc \
SETUPTOOLS_USE_DISTUTILS=stdlib
USER 0
RUN dnf module enable -y nginx:1.20 && \
dnf -y install nginx && \
mkdir -p $OPT_DIR && \
chown -R 1001:0 $OPT_DIR /etc/nginx/nginx.conf && \
chmod -R g=u $OPT_DIR /etc/nginx/nginx.conf
USER 1001
WORKDIR $LS_DIR
# Copy and install middleware dependencies
COPY --chown=1001:0 deploy/requirements-mw.txt .
RUN --mount=type=cache,target=$PIP_CACHE_DIR,uid=1001,gid=0 \
pip3 install uwsgi uwsgitop && \
pip3 install -r requirements-mw.txt
# Copy and install requirements.txt first for caching
COPY --chown=1001:0 deploy/requirements.txt .
RUN --mount=type=cache,target=$PIP_CACHE_DIR,uid=1001,gid=0 \
pip3 install -r requirements.txt
COPY --chown=1001:0 . .
RUN --mount=type=cache,target=$PIP_CACHE_DIR,uid=1001,gid=0 \
pip3 install -e .
RUN rm -rf ./label_studio/frontend
COPY --chown=1001:0 --from=frontend-builder /label-studio/label_studio/frontend/dist ./label_studio/frontend/dist
RUN python3 label_studio/manage.py collectstatic --no-input
EXPOSE 8080
LABEL name="LabelStudio" \
maintainer="[email protected]" \
vendor="Heartex" \
version="1.5.0dev" \
release="1" \
summary="LabelStudio" \
description="Label Studio is an open source data labeling tool."
COPY --chown=1001:0 licenses/ /licenses
RUN cp $LS_DIR/LICENSE /licenses
ENV HOME=/label-studio
ENTRYPOINT ["./deploy/docker-entrypoint.sh"]
CMD ["label-studio"]