File size: 1,213 Bytes
e34a5a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM node:19 as builder-production

RUN --mount=type=secret,id=GIT_TOKEN,mode=0444,required=true \
    git clone https://$(cat /run/secrets/GIT_TOKEN)@github.com/d8a-ai/talk-doc-ui.git /app

WORKDIR /app

RUN --mount=type=cache,target=/app/.npm \
        npm set cache /app/.npm && \
        npm ci --omit=dev

FROM builder-production as builder

RUN --mount=type=cache,target=/app/.npm \
        npm set cache /app/.npm && \
        npm ci

COPY --link --chown=1000 . .

RUN --mount=type=secret,id=DOTENV_LOCAL,dst=.env.local \
    npm --version
RUN --mount=type=secret,id=DOTENV_LOCAL,dst=.env.local \
    npm run build

FROM nikolaik/python-nodejs

RUN npm install -g pm2

RUN --mount=type=secret,id=GIT_TOKEN,mode=0444,required=true \
    git clone https://$(cat /run/secrets/GIT_TOKEN)@github.com/d8a-ai/talk-doc-ui.git /app
RUN pip install -r /app/requirements.txt

COPY --from=builder-production /app/node_modules /app/node_modules
COPY --from=builder /app/build /app/build
RUN echo $(ls /app)
RUN chown 1000 /app
CMD pm2 start /app/build/index.js -i $CPU_CORES --no-daemon