mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-26 09:05:10 +00:00
refactor(frappe-nginx): Dockerfile
This commit is contained in:
parent
cfb71bd587
commit
cc24d6bab5
1 changed files with 33 additions and 31 deletions
|
|
@ -3,58 +3,60 @@
|
||||||
# node-sass is required to enable website theme feature used
|
# node-sass is required to enable website theme feature used
|
||||||
# by Website Manager role in Frappe Framework
|
# by Website Manager role in Frappe Framework
|
||||||
ARG PYTHON_VERSION=3.9
|
ARG PYTHON_VERSION=3.9
|
||||||
FROM python:${PYTHON_VERSION}-slim-bullseye
|
FROM python:${PYTHON_VERSION}-slim-bullseye as builder
|
||||||
|
|
||||||
ARG GIT_REPO=https://github.com/frappe/frappe
|
ARG GIT_REPO=https://github.com/frappe/frappe
|
||||||
ARG GIT_BRANCH=develop
|
ARG GIT_BRANCH=develop
|
||||||
|
|
||||||
|
ENV NODE_VERSION=14.18.1
|
||||||
ENV NVM_DIR=/root/.nvm
|
ENV NVM_DIR=/root/.nvm
|
||||||
ENV NODE_VERSION=14.17.0
|
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
|
||||||
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
|
|
||||||
RUN apt-get update -y \
|
RUN apt-get update \
|
||||||
&& apt-get install wget python2 git build-essential -y \
|
&& apt-get install --no-install-recommends -y \
|
||||||
&& apt-get clean \
|
wget \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
python2 \
|
||||||
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh \
|
git \
|
||||||
&& chmod +x install.sh \
|
build-essential \
|
||||||
&& ./install.sh \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
&& . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} \
|
|
||||||
&& nvm use v${NODE_VERSION} && npm install -g yarn
|
# Install nvm with node and yarn
|
||||||
|
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
|
||||||
|
&& . ${NVM_DIR}/nvm.sh \
|
||||||
|
&& nvm install ${NODE_VERSION} \
|
||||||
|
&& npm install -g yarn \
|
||||||
|
&& rm -rf ${NVM_DIR}/.cache
|
||||||
|
|
||||||
WORKDIR /home/frappe/frappe-bench
|
WORKDIR /home/frappe/frappe-bench
|
||||||
RUN mkdir -p /home/frappe/frappe-bench/sites \
|
|
||||||
&& echo "frappe" > /home/frappe/frappe-bench/sites/apps.txt
|
|
||||||
|
|
||||||
RUN mkdir -p apps sites/assets/css \
|
RUN mkdir -p apps sites/assets/css sites/assets/frappe /var/www/error_pages
|
||||||
&& cd apps \
|
RUN echo "frappe" > sites/apps.txt
|
||||||
&& git clone --depth 1 ${GIT_REPO} --branch $GIT_BRANCH
|
|
||||||
|
|
||||||
RUN cd /home/frappe/frappe-bench/apps/frappe \
|
RUN git clone --depth 1 -b ${GIT_BRANCH} ${GIT_REPO} apps/frappe
|
||||||
|
RUN cd apps/frappe \
|
||||||
&& yarn \
|
&& yarn \
|
||||||
&& yarn run production \
|
&& yarn run production \
|
||||||
&& yarn install --production=true
|
&& yarn install --production=true
|
||||||
|
|
||||||
RUN node --version \
|
|
||||||
&& npm --version \
|
|
||||||
&& yarn --version
|
|
||||||
|
|
||||||
RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \
|
RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \
|
||||||
&& mkdir -p /var/www/error_pages \
|
|
||||||
&& cp -r /tmp/bench/bench/config/templates /var/www/error_pages
|
&& cp -r /tmp/bench/bench/config/templates /var/www/error_pages
|
||||||
|
|
||||||
RUN mkdir -p /home/frappe/frappe-bench/sites/assets/frappe/ \
|
RUN cp -R apps/frappe/frappe/public/* sites/assets/frappe \
|
||||||
&& cp -R /home/frappe/frappe-bench/apps/frappe/frappe/public/* /home/frappe/frappe-bench/sites/assets/frappe \
|
&& cp -R apps/frappe/node_modules sites/assets/frappe/
|
||||||
&& cp -R /home/frappe/frappe-bench/apps/frappe/node_modules /home/frappe/frappe-bench/sites/assets/frappe/
|
|
||||||
|
|
||||||
FROM nginx:latest
|
FROM nginx:latest
|
||||||
COPY --from=0 /home/frappe/frappe-bench/sites /var/www/html/
|
|
||||||
COPY --from=0 /var/www/error_pages /var/www/
|
COPY --from=builder /home/frappe/frappe-bench/sites /var/www/html/
|
||||||
|
COPY --from=builder /var/www/error_pages /var/www/
|
||||||
COPY build/frappe-nginx/nginx-default.conf.template /etc/nginx/conf.d/default.conf.template
|
COPY build/frappe-nginx/nginx-default.conf.template /etc/nginx/conf.d/default.conf.template
|
||||||
COPY build/frappe-nginx/docker-entrypoint.sh /
|
COPY build/frappe-nginx/docker-entrypoint.sh /
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y rsync && apt-get clean \
|
RUN apt-get update \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& apt-get install --no-install-recommends -y \
|
||||||
&& echo "#!/bin/bash" > /rsync \
|
rsync \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN echo "#!/bin/bash" > /rsync \
|
||||||
&& chmod +x /rsync
|
&& chmod +x /rsync
|
||||||
|
|
||||||
VOLUME [ "/assets" ]
|
VOLUME [ "/assets" ]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue