Skip to content

Main #47645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed

Main #47645

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__/
*.pyc
*.pyo
*.pyd
node_modules/
*.db
.env
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3.10-slim

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y curl gnupg && \
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get update && \
apt-get install -y \
cron \
nodejs git curl build-essential mariadb-client redis wget \
supervisor \
libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev \
python3-dev libffi-dev libssl-dev \
&& npm install -g [email protected] && \
apt-get clean

# 安裝 frappe bench CLI
RUN pip install frappe-bench

# 建立 frappe 使用者與 bench 資料夾
RUN useradd -ms /bin/bash frappe
USER frappe
WORKDIR /home/frappe

# 初始化 bench 環境
RUN bench init --frappe-branch version-14 frappe-bench
WORKDIR /home/frappe/frappe-bench

# 複製啟動腳本
COPY --chmod=755 entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
19 changes: 19 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e

cd /home/frappe/frappe-bench

# 安裝 ERPNext app
bench get-app --branch version-14 erpnext

# 建立網站並安裝 app(僅當未建立時)
if [ ! -d "./sites/${SITE_NAME}" ]; then
bench new-site ${SITE_NAME} \
--mariadb-root-password ${MYSQL_ROOT_PASSWORD} \
--admin-password ${ADMIN_PASSWORD} \
--no-mariadb-socket
bench --site ${SITE_NAME} install-app ${INSTALL_APPS}
fi

# 啟動服務
bench start