FROM google/cloud-sdk:277.0.0-alpine
RUN apk --no-cache add openjdk8
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . .
CMD ["/usr/bin/java", "-jar", "/app/myapp.jar"]
注意:替换“myapp.jar”为应用程序的实际名称。
---
- name: Ensure gcloud is installed
shell: |
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud --version
changed_when: false
- name: Authenticate to GCP
shell: gcloud auth activate-service-account --key-file "{{ service_account_key_path }}"
changed_when: false
- name: Deploy to App Engine
shell: gcloud app deploy app.yaml --version="{{ app_version }}" --project="{{ project_id }}"
runtime: custom
env: flex
service: myapp
handlers:
- url: /.*
script: null
# the app listens on port 8080 inside the container
- url: ".*"
script: auto
secure: always
redirect_http_response_code: 301
# specify your Docker image here
# the latest tag is used by default
# you can also specify a different tag, e.g. my-image:v1
# use the command 'docker push gcr.io/PROJECT_ID/your-image:your-tag' to push the image to GCR
# substitute PROJECT_ID with your actual project ID
# and your-image:your-tag with the actual image name and tag
# to build and push the Docker image, use the command 'docker build -t gcr.io/PROJECT_ID/your-image:your
上一篇:Ansible和Kerberos
下一篇:Ansible和密钥库