在使用CPANEL连续部署时,如何自动安装Python软件包?
我正在尝试使用GITHUB操作进行连续的部署工作流程,以在共享托管(CPANEL)上部署。
我已经设置了一个工作流,用于通过使用库FTP-Deploy-Action来服务前端静态页面。 https://github.com/samkirkland/ftp-deploy-action
我希望现在要使用它部署我的Python后端。我已经创建了一个Python应用程序并设置了库,但是我希望能够在以后添加的所有新软件包安装。
我知道有一个.cpanel.yml文件可以自动部署自动化,但是我发现的所有示例包括仅将文件从一个目录复制到另一个目录。
这是我当前的github操作main.yml
文件,它使得CD我的前端文件成为可能。
on:
push:
branches:
- staging
name:
I'm trying to make a Continuous Deployment workflow using GitHub Actions to deploy on shared Hosting (CPanel).
I have setup a workflow for serving the frontend static pages through the use of the library FTP-Deploy-Action. https://github.com/SamKirkland/FTP-Deploy-Action
Now I wish to use it deploy my python backend too. I have created a python app and setup the libraries but I wish to be able to pip install any new packages I add later on.
I know there is a .cpanel.yml file that is suppose to automate Deployment but all the examples I have found consists of just copying files from one directory to another.
This is my current github actions main.yml
file which is making it possible to CD my frontend files.
on:
push:
branches:
- staging
name: ???? Deploy website on push (staging)
jobs:
web-deploy:
name: ???? Deploy
runs-on: ubuntu-latest
steps:
- name: ???? Get latest code
uses: actions/checkout@v2
- name: ???? Build Project
run: |
npm install
npm run build
- name: ???? Sync files (Frontend)
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.ftp_username }}
username: ${{ secrets.ftp_username }}
password: ${{ secrets.ftp_password }}
server-dir: /public_http/
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
**/env/**
**/mywebsite/**
README.md
requirements.txt
I have tried to make this into
on:
push:
branches:
- staging
name: ???? Deploy website on push (staging)
jobs:
web-deploy:
name: ???? Deploy
runs-on: ubuntu-latest
steps:
- name: ???? Get latest code
uses: actions/checkout@v2
- name: ???? Sync files (Frontend)
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.ftp_server }}
username: ${{ secrets.ftp_username }}
password: ${{ secrets.ftp_password }}
server-dir: /public_html/
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
**/env/**
**/mywebsitebackend/**
README.md
requirements.txt
- name: ???? Sync files (Backend)
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.ftp_server }}
username: ${{ secrets.ftp_username }}
password: ${{ secrets.ftp_password }}
server-dir: /mywebsitebackend/
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
**/env/**
README.md
index.html
This can theoretically copy the files into the proper directories but I wish to be able to run python pip install -r requirements.txt
on my remote server automatically.
Is there anyway to run pip install automatically on CPanel?
PS.I read about the Pull and Push workflow but couldn't find a desireable outcome. I wish to push to my github repo and have it all be done automatically.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论