Check if this image helps press/Dockerfile at master · frappe/press · GitHub
I am not the author of this image. I can’t explain the image further. I use frappe_docker to build image.
thanks for your support.
I follow your support. This is my dockerfile:
FROM ubuntu:20.04
Set up environment variables
ENV NVM_VERSION 0.36.0
ENV NODE_VERSION 14.19.0
ENV PYTHON_VERSION 3.10
ENV WKHTMLTOPDF_VERSION 0.12.5
ENV BENCH_VERSION 5.15.2
ENV FRAPPE_VERSION 13
Install essential packages
RUN --mount=type=cache,target=/var/cache/apt apt-get update
&& apt-get install --yes --no-install-suggests --no-install-recommends
build-essential
git
mariadb-server
mariadb-client
libmariadb-dev
pv
ntp
wget
supervisor
software-properties-common
gnupg
libpango-1.0-0
libharfbuzz0b
libpangoft2-1.0-0
libpangocairo-1.0-0
ca-certificates
fontconfig
libfreetype6
libjpeg-turbo8
libpng16-16
libx11-6
libxcb1
libxext6
libxrender1
xfonts-75dpi
xfonts-base
gcc
libcups2-dev
Install Python from PPA
RUN --mount=type=cache,target=/var/cache/apt add-apt-repository ppa:deadsnakes/ppa
&& apt-get update
&& apt-get install --yes --no-install-suggests --no-install-recommends
python${PYTHON_VERSION}
python${PYTHON_VERSION}-dev
python${PYTHON_VERSION}-venv
python${PYTHON_VERSION}-distutils
Install Redis from PPA
RUN --mount=type=cache,target=/var/cache/apt add-apt-repository ppa:redislabs/redis
&& apt-get update
&& apt-get install --yes --no-install-suggests --no-install-recommends
redis-server
Install wkhtmltopdf
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKHTMLTOPDF_VERSION}/wkhtmltox_${WKHTMLTOPDF_VERSION}-1.focal_amd64.deb
&& dpkg -i wkhtmltox_${WKHTMLTOPDF_VERSION}-1.focal_amd64.deb
&& rm wkhtmltox_${WKHTMLTOPDF_VERSION}-1.focal_amd64.deb
Install Fonts
RUN git clone --progress --depth 1 GitHub - frappe/fonts /tmp/fonts
&& rm -rf /etc/fonts && mv /tmp/fonts/etc_fonts /etc/fonts
&& rm -rf /usr/share/fonts && mv /tmp/fonts/usr_share_fonts /usr/share/fonts
&& rm -rf /tmp/fonts
&& fc-cache -fv
Set up mariadb
RUN service mysql start
RUN mysql -e “SET GLOBAL character_set_server = ‘utf8mb4’”
RUN mysql -e “SET GLOBAL collation_server = ‘utf8mb4_unicode_ci’”
RUN mysql -e “CREATE USER ‘test_frappe’@‘localhost’ IDENTIFIED BY ‘test_frappe’”
RUN mysql -e “CREATE DATABASE test_frappe”
RUN mysql -e “GRANT ALL PRIVILEGES ON `test_frappe`.* TO ‘test_frappe’@‘localhost’”
RUN mysql -e “UPDATE mysql.user SET Password=PASSWORD(‘root’) WHERE User=‘root’”
RUN mysql -e “FLUSH PRIVILEGES”
Set up user environment
RUN useradd -ms /bin/bash frappe
USER frappe
WORKDIR /home/frappe
Install Node using NVM
ENV NVM_DIR /home/frappe/.nvm
RUN wget https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh
&& bash install.sh
&& . “/home/frappe/.nvm/nvm.sh”
&& nvm install ${NODE_VERSION}
&& nvm use v${NODE_VERSION}
&& nvm alias default v${NODE_VERSION}
&& rm install.sh
&& nvm cache clear
ENV PATH “$PATH:/home/frappe/.nvm/versions/node/v${NODE_VERSION}/bin”
Install Yarn
RUN --mount=type=cache,target=/home/frappe/.cache,uid=1000,gid=1000 npm install -g yarn
Install Bench
ENV PATH “$PATH:/home/frappe/.local/bin”
RUN wget https://bootstrap.pypa.io/get-pip.py && python${PYTHON_VERSION} get-pip.py
RUN --mount=type=cache,target=/home/frappe/.cache,uid=1000,gid=1000 python${PYTHON_VERSION} -m pip install --upgrade frappe-bench==${BENCH_VERSION}
RUN --mount=type=cache,target=/home/frappe/.cache,uid=1000,gid=1000 python${PYTHON_VERSION} -m pip install Jinja2~=3.0.3
RUN --mount=type=cache,target=/home/frappe/.cache,uid=1000,gid=1000 python${PYTHON_VERSION} -m pip install --upgrade setuptools
RUN git config --global advice.detachedHead false
ENV PYTHONUNBUFFERED 1
Install Frappe app
RUN --mount=type=cache,target=/home/frappe/.cache,uid=1000,gid=1000 bench init --skip-assets --python /usr/bin/python${PYTHON_VERSION} --no-backups frappe-bench --frappe-branch version-${FRAPPE_VERSION}
WORKDIR /home/frappe/frappe-bench
Config site
RUN mkdir -p sites/test_size
COPY --chown=frappe:frappe /helper/site_config.json /home/frappe/frappe-bench/sites/test_size
Test site
RUN bench --version
but when I config to mariadb, it raise error:
#13 [stage-0 8/28] RUN mysql -e “SET GLOBAL character_set_server = ‘utf8mb4’”
#13 1.044 ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111)
Can you help me?
No I cannot help you.
I can only help with frappe_docker, that too most of the things are already answered on forum and GitHub.