-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile
47 lines (33 loc) · 1.34 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
# syntax=docker/dockerfile:1.3
FROM seculayer/python:3.7 AS builder
ARG APP_DIR="/opt/app"
ENV POETRY_VERSION=1.1.13 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
PATH="/root/.local/bin:$PATH"
RUN --mount=type=cache,target=/root/.cache/pip \
pip install install pipx
RUN pipx ensurepath
RUN pipx install "poetry==$POETRY_VERSION"
WORKDIR ${APP_DIR}
COPY pyproject.toml poetry.lock ${APP_DIR}
RUN --mount=type=secret,id=gitconfig,target=/root/.gitconfig,required=true \
--mount=type=secret,id=cert,required=true \
# --mount=type=cache,target=/root/.cache/pypoetry/cache \
# --mount=type=cache,target=/root/.cache/pypoetry/artifacts \
poetry install --no-dev --no-root --no-interaction --no-ansi
FROM seculayer/python:3.7 AS app
ARG APP_DIR="/opt/app/"
ARG CLOUD_AI_DIR="/eyeCloudAI/app/ape/dprs/"
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
RUN mkdir -p ${CLOUD_AI_DIR}
WORKDIR ${CLOUD_AI_DIR}
RUN groupadd -g 1000 aiuser
RUN useradd -r -u 1000 -g aiuser aiuser
RUN chown -R aiuser:aiuser /eyeCloudAI
USER aiuser
COPY --chown=aiuser:aiuser --from=builder ${APP_DIR}/.venv ${CLOUD_AI_DIR}/.venv
COPY --chown=aiuser:aiuser dprs ${CLOUD_AI_DIR}/dprs
COPY --chown=aiuser:aiuser dprs.sh ${CLOUD_AI_DIR}
RUN chmod +x ${CLOUD_AI_DIR}/dprs.sh
ENV PATH="${CLOUD_AI_DIR}/.venv/bin:$PATH"
CMD ["${CLOUD_AI_DIR}/dprs.sh", "0", "chief", "0"]