mirror of
https://github.com/frappe/frappe_docker.git
synced 2025-02-09 15:38:28 +00:00
Optimize worker build
This commit is contained in:
parent
789098f42a
commit
9ae5a1f7bb
@ -1,19 +1,12 @@
|
|||||||
|
# syntax=docker/dockerfile:1.3
|
||||||
|
|
||||||
ARG PYTHON_VERSION
|
ARG PYTHON_VERSION
|
||||||
FROM python:${PYTHON_VERSION}-slim-bullseye as base
|
FROM python:${PYTHON_VERSION}-slim-bullseye as base
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends -y \
|
&& apt-get install --no-install-recommends -y \
|
||||||
# MariaDB
|
|
||||||
mariadb-client \
|
|
||||||
# Postgres
|
# Postgres
|
||||||
postgresql-client \
|
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
# wkhtmltopdf
|
|
||||||
xvfb \
|
|
||||||
libfontconfig \
|
|
||||||
wkhtmltopdf \
|
|
||||||
# For healthcheck.sh in helm chart
|
|
||||||
wait-for-it \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN useradd -ms /bin/bash frappe
|
RUN useradd -ms /bin/bash frappe
|
||||||
@ -24,11 +17,11 @@ WORKDIR /home/frappe/frappe-bench
|
|||||||
RUN pip install --no-cache-dir -U pip wheel \
|
RUN pip install --no-cache-dir -U pip wheel \
|
||||||
&& python -m venv env \
|
&& python -m venv env \
|
||||||
&& env/bin/pip install --no-cache-dir -U pip wheel
|
&& env/bin/pip install --no-cache-dir -U pip wheel
|
||||||
|
|
||||||
|
|
||||||
FROM base as frappe_builder
|
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
|
|
||||||
|
FROM base as build_deps
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends -y \
|
&& apt-get install --no-install-recommends -y \
|
||||||
# Install git here because it is not required in production
|
# Install git here because it is not required in production
|
||||||
@ -40,24 +33,54 @@ RUN apt-get update \
|
|||||||
gcc \
|
gcc \
|
||||||
g++ \
|
g++ \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
USER frappe
|
USER frappe
|
||||||
|
|
||||||
|
|
||||||
|
FROM build_deps as frappe_builder
|
||||||
|
|
||||||
ARG FRAPPE_VERSION
|
ARG FRAPPE_VERSION
|
||||||
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \
|
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \
|
||||||
&& env/bin/pip install --no-cache-dir -e apps/frappe \
|
&& env/bin/pip install --no-cache-dir -e apps/frappe \
|
||||||
&& rm -r apps/frappe/.git
|
&& rm -r apps/frappe/.git
|
||||||
|
|
||||||
|
|
||||||
FROM frappe_builder as erpnext_builder
|
# We split ERPNext wheels build in separate stage to achieve concurrency with Frappe build
|
||||||
|
FROM build_deps as erpnext_wheels
|
||||||
|
|
||||||
ARG ERPNEXT_VERSION
|
ARG ERPNEXT_VERSION
|
||||||
RUN git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \
|
RUN git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \
|
||||||
&& env/bin/pip install --no-cache-dir -e apps/erpnext \
|
|
||||||
&& rm -r apps/erpnext/.git
|
&& rm -r apps/erpnext/.git
|
||||||
|
|
||||||
|
RUN pip wheel --wheel-dir /home/frappe/erpnext-wheels -r apps/erpnext/requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
FROM frappe_builder as erpnext_builder
|
||||||
|
|
||||||
|
COPY --from=erpnext_wheels --chown=frappe /home/frappe/frappe-bench/apps/erpnext /home/frappe/frappe-bench/apps/erpnext
|
||||||
|
RUN --mount=type=bind,target=/home/frappe/erpnext-wheels,source=/home/frappe/erpnext-wheels,from=erpnext_wheels \
|
||||||
|
--mount=type=cache,target=/home/frappe/.cache/pip,source=/home/frappe/.cache/pip,from=erpnext_wheels \
|
||||||
|
env/bin/pip install --find-links=/home/frappe/erpnext-wheels --no-cache-dir -e apps/erpnext
|
||||||
|
|
||||||
|
|
||||||
FROM base as configured_base
|
FROM base as configured_base
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install --no-install-recommends -y \
|
||||||
|
# MariaDB
|
||||||
|
mariadb-client \
|
||||||
|
# Postgres
|
||||||
|
postgresql-client \
|
||||||
|
# wkhtmltopdf
|
||||||
|
xvfb \
|
||||||
|
libfontconfig \
|
||||||
|
wkhtmltopdf \
|
||||||
|
# For healthcheck.sh in helm chart
|
||||||
|
wait-for-it \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
USER frappe
|
||||||
|
|
||||||
COPY pretend-bench.sh /usr/local/bin/bench
|
COPY pretend-bench.sh /usr/local/bin/bench
|
||||||
COPY push_backup.py /usr/local/bin/push-backup
|
COPY push_backup.py /usr/local/bin/push-backup
|
||||||
# healthcheck.sh used in helm chart
|
# healthcheck.sh used in helm chart
|
||||||
|
Loading…
x
Reference in New Issue
Block a user