后端移动文件夹,前端在docker中编译,进一步减小镜像大小

This commit is contained in:
buyfakett committed 2024-05-02 00:29:33 +08:00
1 parent 1da94636b9
commit 3563b86b82
20 files changed
+24 -8

No files matched your search

+17 -4
View File
@@ -1,13 +1,26 @@
FROM python:3.9.5-alpine
FROM node:18-alpine as webui
COPY . /app
WORKDIR /app/fcb-fronted/
ENV NPM_CONFIG_LOGLEVEL=verbose
RUN npm i
RUN npm run build-only
# 似乎需要把文件移动才能正常
RUN mv dist/logo_small.png dist/assets/
FROM python:3.9.5-alpine as FileCodeBox
LABEL author="Lan"
LABEL email="vast@tom.com"
LABEL version="6"
COPY . /app
# 先安装依赖可以产生缓存
WORKDIR /app
COPY requirements.txt /app
RUN /usr/local/bin/python -m pip install --upgrade pip && pip install -r requirements.txt
COPY ./backend/ /app
COPY --from=webui /app/fcb-fronted/dist/ /app/dist
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 12345
CMD ["python","main.py"]