j commited on
Commit
7a84f72
1 Parent(s): f28d106

change user in dockerfile before copying files

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -17
Dockerfile CHANGED
@@ -10,9 +10,7 @@ ENV POETRY_VENV=/app/.venv
10
  ENV HF_HOME="/app/.cache"
11
  ENV ASR_MODEL_PATH="/app/.cache"
12
 
13
- RUN export DEBIAN_FRONTEND=noninteractive \
14
- && apt-get -qq update \
15
- && apt-get -qq install --no-install-recommends \
16
  python${PYTHON_VERSION} \
17
  python${PYTHON_VERSION}-venv \
18
  python3-pip \
@@ -32,27 +30,22 @@ RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
32
  RUN groupadd -g $SERVICE_GID $SERVICE_USER && \
33
  useradd -u $SERVICE_UID -g $SERVICE_GID -d /app -s /usr/sbin/nologin $SERVICE_USER
34
 
35
- RUN getent group $SERVICE_USER
36
- RUN getent passwd $SERVICE_USER
 
 
 
 
37
 
38
  COPY --chown=$SERVICE_UID:$SERVICE_GID . /app
39
  COPY --chown=$SERVICE_UID:$SERVICE_GID --from=swagger-ui /usr/share/nginx/html/swagger-ui.css /app/swagger-ui-assets/swagger-ui.css
40
  COPY --chown=$SERVICE_UID:$SERVICE_GID --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js /app/swagger-ui-assets/swagger-ui-bundle.js
41
 
42
- RUN chown -R $SERVICE_UID:$SERVICE_GID /app
43
-
44
- RUN ls -la /app
45
- RUN mkdir -p /app/.cache && chown -R $SERVICE_UID:$SERVICE_GID /app/.cache && ls -la /app/.cache
46
-
47
- USER $SERVICE_USER
48
-
49
- WORKDIR /app
50
 
51
  RUN python3 -m venv $POETRY_VENV && $POETRY_VENV/bin/pip install -U pip setuptools && \
52
  $POETRY_VENV/bin/pip install poetry==1.6.1
53
 
54
- ENV PATH="${PATH}:${POETRY_VENV}/bin"
55
-
56
  COPY --chown=$SERVICE_UID:$SERVICE_GID poetry.lock pyproject.toml ./
57
 
58
  RUN poetry config virtualenvs.in-project true
@@ -62,9 +55,7 @@ RUN poetry install && rm -rf /app/.cache/pypoetry
62
  RUN $POETRY_VENV/bin/pip install --no-cache-dir torch==1.13.1+cu117 -f https://download.pytorch.org/whl/torch
63
 
64
  WORKDIR /app/reascripts/ReaSpeech
65
-
66
  RUN ls -la /app/reascripts/ReaSpeech
67
-
68
  RUN make publish
69
 
70
  WORKDIR /app
 
10
  ENV HF_HOME="/app/.cache"
11
  ENV ASR_MODEL_PATH="/app/.cache"
12
 
13
+ RUN export DEBIAN_FRONTEND=noninteractive && apt-get -qq update && apt-get -qq install --no-install-recommends \
 
 
14
  python${PYTHON_VERSION} \
15
  python${PYTHON_VERSION}-venv \
16
  python3-pip \
 
30
  RUN groupadd -g $SERVICE_GID $SERVICE_USER && \
31
  useradd -u $SERVICE_UID -g $SERVICE_GID -d /app -s /usr/sbin/nologin $SERVICE_USER
32
 
33
+ USER $SERVICE_USER
34
+ WORKDIR /app
35
+
36
+ ENV HF_HOME="/app/.cache"
37
+ ENV ASR_MODEL_PATH="/app/.cache"
38
+ ENV PATH="${PATH}:${POETRY_VENV}/bin"
39
 
40
  COPY --chown=$SERVICE_UID:$SERVICE_GID . /app
41
  COPY --chown=$SERVICE_UID:$SERVICE_GID --from=swagger-ui /usr/share/nginx/html/swagger-ui.css /app/swagger-ui-assets/swagger-ui.css
42
  COPY --chown=$SERVICE_UID:$SERVICE_GID --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js /app/swagger-ui-assets/swagger-ui-bundle.js
43
 
44
+ RUN mkdir -p /app/.cache && chown -R $SERVICE_UID:$SERVICE_GID /app/.cache
 
 
 
 
 
 
 
45
 
46
  RUN python3 -m venv $POETRY_VENV && $POETRY_VENV/bin/pip install -U pip setuptools && \
47
  $POETRY_VENV/bin/pip install poetry==1.6.1
48
 
 
 
49
  COPY --chown=$SERVICE_UID:$SERVICE_GID poetry.lock pyproject.toml ./
50
 
51
  RUN poetry config virtualenvs.in-project true
 
55
  RUN $POETRY_VENV/bin/pip install --no-cache-dir torch==1.13.1+cu117 -f https://download.pytorch.org/whl/torch
56
 
57
  WORKDIR /app/reascripts/ReaSpeech
 
58
  RUN ls -la /app/reascripts/ReaSpeech
 
59
  RUN make publish
60
 
61
  WORKDIR /app