mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
chore(docker): Remove intermediate stage (#6068)
removes the prebuild stage from the final image which solves the issue that build dependencies where not cleaned up properly. Saves a couple of MB in image size.
This commit is contained in:
parent
b59cf0f4a4
commit
9ecaea2c12
@ -94,8 +94,9 @@ ENTRYPOINT ["/bin/sh", "./init.sh"]
|
||||
|
||||
FROM inventree_base as prebuild
|
||||
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
RUN ./install_build_packages.sh --no-cache --virtual .build-deps && \
|
||||
pip install -r base_requirements.txt -r requirements.txt --no-cache-dir && \
|
||||
pip install --user -r base_requirements.txt -r requirements.txt --no-cache-dir && \
|
||||
apk --purge del .build-deps
|
||||
|
||||
# Frontend builder image:
|
||||
@ -111,7 +112,7 @@ RUN cd ${INVENTREE_HOME}/InvenTree && inv frontend-compile
|
||||
# InvenTree production image:
|
||||
# - Copies required files from local directory
|
||||
# - Starts a gunicorn webserver
|
||||
FROM prebuild as production
|
||||
FROM inventree_base as production
|
||||
|
||||
ENV INVENTREE_DEBUG=False
|
||||
|
||||
@ -119,6 +120,10 @@ ENV INVENTREE_DEBUG=False
|
||||
ENV INVENTREE_COMMIT_HASH="${commit_hash}"
|
||||
ENV INVENTREE_COMMIT_DATE="${commit_date}"
|
||||
|
||||
# use dependencies and compiled wheels from the prebuild image
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
COPY --from=prebuild /root/.local /root/.local
|
||||
|
||||
# Copy source code
|
||||
COPY InvenTree ./InvenTree
|
||||
COPY --from=frontend ${INVENTREE_HOME}/InvenTree/web/static/web ./InvenTree/web/static/web
|
||||
|
Loading…
Reference in New Issue
Block a user