-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.cuda
52 lines (35 loc) · 1.47 KB
/
Dockerfile.cuda
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
FROM node:20-bookworm-slim AS builder
WORKDIR /builder
COPY package*.json ./
RUN npm ci --omit dev
# RUN npm install
FROM node:20-bookworm-slim AS cuda_installer
WORKDIR /builder
RUN apt update && \
apt install -y --no-install-recommends \
curl wget openssl ca-certificates && \
rm -rf /var/lib/apt/lists/*
RUN curl -L https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname -s)-$(uname -m).sh -o $HOME/miniforge-installer.sh && \
bash $HOME/miniforge-installer.sh -b -u -p $HOME/miniconda3 && rm -rf $HOME/miniforge-installer.sh
RUN $HOME/miniconda3/bin/conda init bash && $HOME/miniconda3/bin/conda config --set auto_activate_base false && \
$HOME/miniconda3/bin/conda create -n cuda11 -c conda-forge python=3.9 cudatoolkit=11.6 cudnn=8 -y
FROM node:20-bookworm-slim AS final
ENV PORT=8081
ENV API_TOKEN=myapitokenchangethislater
ENV ENABLE_API_TOKEN=false
ENV IMG_DOWNLOAD_PATH=/tmp/
ENV MAX_VIDEO_SIZE_MB=100
ENV CACHE_DURATION_IN_SECONDS=86400
ENV MAX_CACHE_ITEM_NUM=200000
ARG APP_USER=node
ENV USER=$APP_USER
ENV HOME=/home/$APP_USER
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/miniconda3/envs/cuda11/lib/
ENV TF_FORCE_GPU_ALLOW_GROWTH=true
WORKDIR /app
COPY --from=builder --chown=$APP_USER:$APP_USER /builder/node_modules /app/node_modules
COPY --from=cuda_installer --chown=$APP_USER:$APP_USER /root/miniconda3 $HOME/miniconda3
COPY --chown=$APP_USER:$APP_USER . .
USER $APP_USER
EXPOSE $PORT
ENTRYPOINT ["node", "src/index.mjs"]