File size: 1,240 Bytes
433b752
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1cf582c
433b752
1cf582c
433b752
 
 
1cf582c
 
433b752
 
 
 
 
 
 
 
 
e862b30
880ae7f
 
433b752
 
 
 
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
ARG MODEL_NAME
ARG MODEL_PARAMS
ARG MODEL_PROMPT_TEMPLATE
ARG APP_COLOR
ARG APP_NAME

FROM ghcr.io/huggingface/text-generation-inference:latest

ARG MODEL_NAME
ARG MODEL_PARAMS
ARG MODEL_PROMPT_TEMPLATE
ARG APP_COLOR
ARG APP_NAME

ENV TZ=Europe/Paris \
    PORT=3000

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    gnupg \
    curl \
    gettext && \
    rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh.template entrypoint.sh.template

RUN mkdir defaults
ADD defaults /defaults
RUN chmod -R 777 /defaults

RUN MODEL_NAME="${MODEL_NAME:="$(cat /defaults/MODEL_NAME)"}" && export MODEL_NAME \
    && MODEL_PARAMS="${MODEL_PARAMS:="$(cat /defaults/MODEL_PARAMS)"}" && export MODEL_PARAMS \
    && MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:="$(cat /defaults/MODEL_PROMPT_TEMPLATE)"}" && export MODEL_PROMPT_TEMPLATE && \
    envsubst < "entrypoint.sh.template" > "entrypoint.sh" \
    && rm entrypoint.sh.template

# RUN mkdir /app
# RUN chown -R 1000:1000 /app

RUN useradd -m -u 1000 user

# Switch to the "user" user
USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

RUN pip install gradio
COPY main.py main.py

ENTRYPOINT ["/bin/bash"]
CMD ["entrypoint.sh"]