2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-24 19:10:25 +00:00
frappe_docker/build/frappe-worker/Dockerfile
2021-01-05 14:47:01 +05:30

85 lines
2.7 KiB
Docker

FROM python:3.7-slim-buster
# Add non root user without password
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS -1/' /etc/login.defs \
&& sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS -1/' /etc/login.defs \
&& useradd -ms /bin/bash frappe
ARG GIT_BRANCH=develop
ENV PYTHONUNBUFFERED 1
ENV NVM_DIR=/home/frappe/.nvm
ENV NODE_VERSION=12.20.0
ENV PATH="/home/frappe/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
# Install dependencies
WORKDIR /home/frappe/frappe-bench
RUN apt-get update -y && apt-get install \
git \
mariadb-client \
postgresql-client \
gettext-base \
wget \
# for PDF
fonts-cantarell \
libffi-dev \
libjpeg-dev \
libjpeg62-turbo \
libxcb1 \
libxext6 \
libx11-6 \
libxml2 \
libxrender1 \
libssl-dev \
xfonts-75dpi \
xfonts-base \
zlib1g-dev \
# For psycopg2
libpq-dev \
wait-for-it -y \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb \
&& dpkg -i wkhtmltox_0.12.6-1.buster_arm64.deb && rm wkhtmltox_0.12.6-1.buster_arm64.deb \
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh \
&& apt-get purge -y wget && apt-get autoremove -y \
&& chown -R frappe:frappe /home/frappe
USER frappe
# Install nvm with node
RUN bash install.sh \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install ${NODE_VERSION} \
&& nvm use v${NODE_VERSION} \
&& nvm alias default v${NODE_VERSION}
# Create frappe-bench directories
RUN mkdir -p apps logs commands /home/frappe/backups
# Setup python environment
RUN python -m venv env \
&& . env/bin/activate \
&& cd apps \
&& git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch ${GIT_BRANCH} \
&& pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe
USER root
# Copy scripts and templates
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template
COPY build/common/worker/install_app.sh /usr/local/bin/install_app
COPY build/common/worker/bench /usr/local/bin/bench
COPY build/common/worker/healthcheck.sh /usr/local/bin/healthcheck.sh
# Setup docker-entrypoint
COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat
# Use sites volume as working directory
WORKDIR /home/frappe/frappe-bench/sites
# Set ownership of sites directory
RUN chown -R frappe:frappe /home/frappe/frappe-bench/sites
VOLUME [ "/home/frappe/frappe-bench/sites", "/home/frappe/backups" ]
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["start"]