-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (29 loc) · 1.02 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
FROM python:3.10-bookworm as builder
WORKDIR /builder
RUN addgroup --gid 1000 user
RUN adduser --disabled-password --gecos '' --uid 1000 --gid 1000 user
ENV USER=user
ENV HOME=/home/user
RUN python3 -mvenv venv && ./venv/bin/pip install --no-cache-dir --upgrade pip
COPY requirements.txt requirements.txt
RUN ./venv/bin/pip install -U --no-cache-dir -r requirements.txt
FROM python:3.10-bookworm as runner
WORKDIR /app
RUN addgroup --gid 1000 user
RUN adduser --disabled-password --gecos '' --uid 1000 --gid 1000 user
ENV USER=user
ENV HOME=/home/user
COPY --from=builder --chown=user:user /builder/venv /app/venv
COPY --chown=user:user app.py app.py
RUN chown -R user:user /app && chown -R user:user /home/user
USER user
ENV ENABLE_API_TOKEN=false
ENV API_TOKEN=
ENV APP_ENV=production
ENV LISTEN_HOST=0.0.0.0
ENV LISTEN_PORT=5000
ENV SENTIMENT_ANALYSIS_MODEL="cardiffnlp/twitter-roberta-base-sentiment-latest"
ENV ENABLE_CACHE=false
ENV CACHE_DURATION_SECONDS=60
EXPOSE $LISTEN_PORT
ENTRYPOINT [ "./venv/bin/python" , "app.py" ]