为PHP设置自动部署

为PHP设置自动部署,php,kubernetes,google-cloud-platform,gitlab,Php,Kubernetes,Google Cloud Platform,Gitlab,你好 问题 我一直在尝试使用Google云平台为我的Kubernetes部署本地PHP代码,该代码托管在GitLab中。我已经成功地将该项目链接到Kubernetes,但我无法将其部署到生产环境中,因为我对如何使用.yml configs知之甚少或一无所知 尝试过的解决方案和代码 .gitlab ci.yml 应用程序yaml 调度。yaml 试图实现的结果 因此,我试图为初学者归档的是,生产部门安装具有所有依赖项的PHP,有一个应用程序暂存、生产阶段,并指定我要为应用程序提供服务的域 建议是非

你好

问题 我一直在尝试使用Google云平台为我的Kubernetes部署本地PHP代码,该代码托管在GitLab中。我已经成功地将该项目链接到Kubernetes,但我无法将其部署到生产环境中,因为我对如何使用.yml configs知之甚少或一无所知

尝试过的解决方案和代码

.gitlab ci.yml

应用程序yaml

调度。yaml

试图实现的结果 因此,我试图为初学者归档的是,生产部门安装具有所有依赖项的PHP,有一个应用程序暂存、生产阶段,并指定我要为应用程序提供服务的域

建议是非常受欢迎的
image: google/cloud-sdk:alpine

deploy_production:
  stage: deploy
  environment: Production
  only:
  - master
  script:
  - echo $SERVICE_ACCOUNT > /tmp/$CI_PIPELINE_ID.json
  - gcloud auth activate-service-account --key-file /tmp/$CI_PIPELINE_ID.json
  - gcloud --quiet --project $PROJECT_ID app deploy app.yaml dispatch.yaml

after_script:
- rm /tmp/$CI_PIPELINE_ID.json
runtime: php73 # Replace with php73 to use the PHP 7.3 runtime

handlers:
# Serve a directory as a static resource.
- url: /stylesheets
  static_dir: stylesheets
  secure: always


# Serve images as static resources.
- url: /(.+\.(gif|png|jpg))$
  static_files: \1
  upload: .+\.(gif|png|jpg)$

# Serve your app through a front controller at index.php or public/index.php.
- url: .*
  script: auto
dispatch:
  - url: "example.com/*"
    service: default