2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-10 17:24:43 +00:00
frappe_docker/build/frappe-nginx/Dockerfile
Lev 7c157aa487
refactor: Dockerfiles (#555)
* refactor(frappe-worker): Dockerfile

* fix(frappe-worker): Cloning frappe repo

* refactor(frappe-nginx): Dockerfile

* refactor(erpnext-nginx): Dockerfile

* chore(frappe-worker): Add space in Dockerfile

* refactor(bench): Dockerfile

* refactor(frappe-socketio): Dockerfile

* ci(Test): Add `workflow_dispatch` trigger

* fix(bench): Uncomment missing package

* fix(bench): Replace legacy `libmariadbclient-dev` with `libmariadb-dev`

* refactor(erpnext-nginx): Install script

- Remove repetitive code
- Don't explicitly install production deps (they are installed via plain `yarn` with dev deps)
- Don't write to lockfiles

* fix(erpnext-nginx): use -e flag, fix installation

* fix(erpnext-nginx): Don't install unused wget

* fix(frappe-nginx): Get newest certificates

* fix: Install ca-certificates on erpnext-nginx instead of frappe-nginx

* trigger ci

* ci(test): Fix trigger duplicate

* chore: Fix linting
2021-11-10 04:43:46 +05:30

66 lines
2.0 KiB
Docker

# This image uses nvm and same base image as the worker image.
# This is done to ensures that node-sass binary remains common.
# node-sass is required to enable website theme feature used
# by Website Manager role in Frappe Framework
ARG PYTHON_VERSION=3.9
FROM python:${PYTHON_VERSION}-slim-bullseye as builder
ARG GIT_REPO=https://github.com/frappe/frappe
ARG GIT_BRANCH=develop
ENV NODE_VERSION=14.18.1
ENV NVM_DIR=/root/.nvm
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
git \
build-essential \
wget \
python2 \
&& rm -rf /var/lib/apt/lists/*
# 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
RUN mkdir -p apps sites/assets/css sites/assets/frappe /var/www/error_pages
RUN echo "frappe" > sites/apps.txt
RUN git clone --depth 1 -b ${GIT_BRANCH} ${GIT_REPO} apps/frappe
RUN cd apps/frappe \
&& yarn \
&& yarn run production \
&& yarn install --production=true
RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \
&& cp -r /tmp/bench/bench/config/templates /var/www/error_pages
RUN cp -R apps/frappe/frappe/public/* sites/assets/frappe \
&& cp -R apps/frappe/node_modules sites/assets/frappe/
FROM nginx:latest
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/docker-entrypoint.sh /
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
rsync \
&& rm -rf /var/lib/apt/lists/*
RUN echo "#!/bin/bash" > /rsync \
&& chmod +x /rsync
VOLUME [ "/assets" ]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]