Skip to content

Commit fa5aacf

Browse files
authored
Merge pull request #152 from buyfakett/master
减小docker镜像
2 parents 9602ad3 + 3563b86 commit fa5aacf

File tree

20 files changed

+24
-8
lines changed

20 files changed

+24
-8
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.md
2+
.idea
3+
.git

Dockerfile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
FROM python:3.9.5-slim-buster
1+
FROM node:18-alpine as webui
2+
COPY . /app
3+
WORKDIR /app/fcb-fronted/
4+
ENV NPM_CONFIG_LOGLEVEL=verbose
5+
RUN npm i
6+
RUN npm run build-only
7+
# 似乎需要把文件移动才能正常
8+
RUN mv dist/logo_small.png dist/assets/
9+
10+
11+
FROM python:3.9.5-alpine as FileCodeBox
212
LABEL author="Lan"
313
LABEL email="[email protected]"
414
LABEL version="6"
515

616

7-
COPY . /app
17+
# 先安装依赖可以产生缓存
18+
WORKDIR /app
19+
COPY requirements.txt /app
20+
RUN /usr/local/bin/python -m pip install --upgrade pip && pip install -r requirements.txt
21+
COPY ./backend/ /app
22+
COPY --from=webui /app/fcb-fronted/dist/ /app/dist
823
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
924
RUN echo 'Asia/Shanghai' >/etc/timezone
10-
WORKDIR /app
11-
RUN pip install -r requirements.txt
1225
EXPOSE 12345
1326
CMD ["python","main.py"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)