Skip to content

Commit ba067c5

Browse files
build: reduce image size.
1 parent 5b14d62 commit ba067c5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

installer/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN apt-get update && \
1616
apt-get clean all && \
1717
rm -rf /var/lib/apt/lists/*
1818

19-
COPY . /opt/maxkb-app
19+
COPY --chmod=700 . /opt/maxkb-app
2020

2121
WORKDIR /opt/maxkb-app
2222
RUN rm -rf /opt/maxkb-app/ui && \
@@ -31,6 +31,7 @@ RUN rm -rf /opt/maxkb-app/ui && \
3131
export PIP_TARGET=/opt/maxkb-app/sandbox/python-packages && \
3232
pip install requests pymysql psycopg2-binary && \
3333
rm -rf /opt/maxkb-app/installer
34+
COPY --from=web-build --chmod=700 ui /opt/maxkb-app/ui
3435

3536
FROM ghcr.io/1panel-dev/maxkb-base:python3.11-pg17.5
3637
ARG DOCKER_IMAGE_TAG=dev \
@@ -61,11 +62,9 @@ ENV MAXKB_VERSION="${DOCKER_IMAGE_TAG} (build at ${BUILD_AT}, commit: ${GITHUB_C
6162

6263
WORKDIR /opt/maxkb-app
6364
COPY --from=stage-build /opt/maxkb-app /opt/maxkb-app
64-
COPY --from=web-build ui /opt/maxkb-app/ui
6565
COPY --from=stage-build /opt/py3 /opt/py3
6666

67-
RUN chmod 755 /tmp && \
68-
find /opt/maxkb-app -mindepth 1 -not -name 'sandbox' -exec chmod 700 {} +
67+
RUN chmod 755 /tmp
6968

7069
EXPOSE 8080
7170
VOLUME /opt/maxkb

installer/Dockerfile-base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM python:3.11-slim-bullseye AS python-stage
22
FROM ghcr.io/1panel-dev/maxkb-vector-model:v2.0.2 AS vector-model
33
FROM postgres:17.5-bullseye
44
COPY --from=python-stage /usr/local /usr/local
5-
COPY --from=vector-model /opt/maxkb-app/model /opt/maxkb-app/model
65
COPY installer/*.sh /usr/bin/
76
COPY installer/init.sql /docker-entrypoint-initdb.d/
87

@@ -31,6 +30,7 @@ RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
3130
chmod g+x /usr/local/bin/python* && \
3231
apt-get clean all && \
3332
rm -rf /var/lib/apt/lists/* /usr/share/doc/* /usr/share/man/* /usr/share/info/* /usr/share/locale/* /usr/share/lintian/* /usr/share/linda/* /var/cache/* /var/log/* /var/tmp/* /tmp/*
33+
COPY --from=vector-model --chmod=700 /opt/maxkb-app/model /opt/maxkb-app/model
3434

3535
ENV PGDATA=/opt/maxkb/data/postgresql/pgdata \
3636
POSTGRES_USER=root \

0 commit comments

Comments
 (0)