UnisKB/installer/Dockerfile

44 lines
1.4 KiB
Docker
Raw Normal View History

2024-03-19 02:11:58 +00:00
FROM ghcr.io/1panel-dev/maxkb-vector-model:v1.0.0 as vector-model
2024-01-31 08:55:35 +00:00
FROM node:18-alpine3.18 as web-build
COPY ui ui
RUN cd ui && \
npm install && \
2024-03-04 10:48:16 +00:00
npm run build && \
rm -rf ./node_modules
2024-01-31 08:55:35 +00:00
2024-03-19 02:11:58 +00:00
FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3
2024-01-30 12:40:54 +00:00
# 创建工作目录
2024-03-15 02:54:29 +00:00
RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf
2024-01-30 12:40:54 +00:00
# 拷贝项目
COPY . /opt/maxkb/app
2024-03-15 05:01:33 +00:00
COPY installer/config.yaml /opt/maxkb/conf
2024-03-15 10:48:17 +00:00
ENV POSTGRES_USER root
ENV POSTGRES_PASSWORD Password123@postgres
2024-03-15 04:58:46 +00:00
RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build
2024-03-15 05:38:10 +00:00
COPY --from=vector-model model /opt/maxkb/app/model
2024-01-31 08:55:35 +00:00
COPY --from=web-build ui /opt/maxkb/app/ui
2024-01-31 09:18:19 +00:00
RUN ls -la /opt/maxkb/app
2024-01-30 12:40:54 +00:00
# 复制模型
RUN mv /opt/maxkb/app/model/* /opt/maxkb/model
RUN ls /opt/maxkb/model
2024-02-01 01:23:17 +00:00
RUN cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer
2024-01-30 12:40:54 +00:00
# 设置工作目录
WORKDIR /opt/maxkb/app
# 更新apt-get包管理器
RUN apt-get update&&apt-get install -y curl
# 更新pip
RUN pip3 install --upgrade pip
# 安装 poetry包管理器
RUN pip3 install poetry
2024-03-15 02:54:29 +00:00
# 导出依赖
2024-01-30 12:40:54 +00:00
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# 下载python依赖
2024-01-31 08:55:35 +00:00
RUN pip3 install --no-cache-dir -r requirements.txt
2024-01-30 12:40:54 +00:00
# 启动命令
2024-03-18 01:48:55 +00:00
VOLUME /opt/maxkb/conf
2024-03-15 05:46:31 +00:00
EXPOSE 8000
2024-03-15 05:01:33 +00:00
COPY installer/run-maxkb.sh /usr/bin/
2024-03-15 02:54:29 +00:00
RUN chmod 755 /usr/bin/run-maxkb.sh
ENTRYPOINT ["bash", "-c"]
CMD [ "/usr/bin/run-maxkb.sh" ]