Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
python3.12-node22-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eazy-template
python3.12-node22-template
Commits
67e43a7f
Commit
67e43a7f
authored
Sep 16, 2025
by
dev-user-56145a-1749186738
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.eazytec-cloud.com/eazy-template/python12-node-template
parents
e60e2709
dd4f5471
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
Dockerfile
Dockerfile
+9
-12
No files found.
Dockerfile
View file @
67e43a7f
# 多阶段构建:Python + Node.js 全栈应用
# 多阶段构建:Python + Node.js 全栈应用
FROM
hb.eazytec-cloud.com/eazytec/eazydevelop-python-node:ubuntu22.04-python3.1
1
-node22 AS python-base
FROM
hb.eazytec-cloud.com/eazytec/eazydevelop-python-node:ubuntu22.04-python3.1
2
-node22 AS python-base
# 设置工作目录
# 设置工作目录
WORKDIR
/app
WORKDIR
/app
...
@@ -16,7 +16,7 @@ RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ &&
...
@@ -16,7 +16,7 @@ RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ &&
pip
install
--no-cache-dir
-r
backend/requirements.txt
pip
install
--no-cache-dir
-r
backend/requirements.txt
# Node.js 阶段
# Node.js 阶段
FROM
hb.eazytec-cloud.com/eazytec/eazydevelop-python-node:ubuntu22.04-python3.1
1
-node22 AS node-base
FROM
hb.eazytec-cloud.com/eazytec/eazydevelop-python-node:ubuntu22.04-python3.1
2
-node22 AS node-base
# 设置工作目录
# 设置工作目录
WORKDIR
/app
WORKDIR
/app
...
@@ -33,14 +33,14 @@ RUN cd frontend && npm config set registry https://registry.npmmirror.com && \
...
@@ -33,14 +33,14 @@ RUN cd frontend && npm config set registry https://registry.npmmirror.com && \
npm
install
--production
npm
install
--production
# 最终阶段:合并两个服务
# 最终阶段:合并两个服务
FROM
hb.eazytec-cloud.com/eazytec/eazydevelop-python-node:ubuntu22.04-python3.1
1
-node22
FROM
hb.eazytec-cloud.com/eazytec/eazydevelop-python-node:ubuntu22.04-python3.1
2
-node22
# 设置工作目录
# 设置工作目录
WORKDIR
/app
WORKDIR
/app
# 复制 Python 后端
# 复制 Python 后端
COPY
--from=python-base /app/backend/ /app/backend/
COPY
--from=python-base /app/backend/ /app/backend/
COPY
--from=python-base /usr/local/lib/python3.1
1/site-packages/ /usr/local/lib/python3.11
/site-packages/
COPY
--from=python-base /usr/local/lib/python3.1
2/site-packages/ /usr/local/lib/python3.12
/site-packages/
# 复制 Node.js 前端
# 复制 Node.js 前端
COPY
--from=node-base /app/frontend/ /app/frontend/
COPY
--from=node-base /app/frontend/ /app/frontend/
...
@@ -51,19 +51,16 @@ COPY --from=node-base /usr/local/lib/node_modules/ /usr/local/lib/node_modules/
...
@@ -51,19 +51,16 @@ COPY --from=node-base /usr/local/lib/node_modules/ /usr/local/lib/node_modules/
# 复制资源文件
# 复制资源文件
COPY
.resource/ /app/.resource/
COPY
.resource/ /app/.resource/
# 拷贝启动脚本
COPY
start.sh /app/start.sh
# 设置环境变量
# 设置环境变量
ENV
RESOURCE_PATH=/app/.resource/resource_deploy.json
ENV
RESOURCE_PATH=/app/.resource/resource_deploy.json
ENV
PYTHONPATH=/app/backend
ENV
PYTHONPATH=/app/backend
ENV
NODE_ENV=production
ENV
NODE_ENV=production
# 创建启动脚本
# 设置启动脚本权限
RUN
echo
'#!/bin/bash\n
\
RUN
chmod
+x /app/start.sh
# 启动 Python 后端\n
\
cd /app/backend && python app.py &\n
\
# 启动 Node.js 前端\n
\
cd /app/frontend && node server.js &\n
\
# 等待所有后台进程\n
\
wait'
>
/app/start.sh
&&
chmod
+x /app/start.sh
# 暴露端口
# 暴露端口
EXPOSE
$APP_PORT_1 $APP_PORT_2
EXPOSE
$APP_PORT_1 $APP_PORT_2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment