-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
24 lines (21 loc) · 1.17 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
FROM node:18-bullseye-slim
ENV NODE_ENV=production
# follow openshfit guidelines for supporting arbitrary user IDs
# https://docs.openshift.com/container-platform/4.16/creating_images/guidelines.html#openshift-container-platform-specific-guidelines
RUN mkdir -p /usr/src/app /etc/config && \
chgrp -R 0 /usr/src/app /etc/config && \
chmod -R g=u /usr/src/app /etc/config
COPY . /usr/src/app
# Reinstall onnxruntime-node based on current building platform architecture
RUN cd /usr/src/app/component/node_modules/onnxruntime-node && npm run postinstall
# Reinstall sharp based on current building platform architecture
RUN cd /usr/src/app/component/node_modules && rm -Rf @img && cd sharp && npm install
# remove downloaded model cache
RUN cd /usr/src/app/component/node_modules/@huggingface/transformers && rm -Rf .cache && mkdir .cache
# download default model
RUN cd /usr/src/app/component && npm run download-default-model
# make local cache folder writable by 1000 user
RUN chown -R 1000 /usr/src/app/component/node_modules/@huggingface/transformers/.cache
USER 1000
WORKDIR /usr/src/app/component
CMD [ "node", "./node_modules/fastify-cli/cli.js", "start", "-l", "info", "dist/app.js"]