'Flask app deployed to GCP Run through bitbucket
I am struggling to get my dockerised flask app to a GCP run instance through bitbucket pipelines.
Here is my bitbucket-pipeline.yml:
image: python:3.9
pipelines:
default:
- parallel:
- step:
name: Build and test
caches:
- pip
script:
- pip install -r requirements.txt
- pytest
- step:
name: Linter
script:
- pip install flake8
- flake8 . --extend-exclude=dist,build --show-source --statistics
branches:
develop:
- parallel:
- step:
name: Build and test
caches:
- pip
script:
- pip install -r requirements.txt
- pytest
- step:
name: Linter
script:
- pip install flake8
- flake8 . --extend-exclude=dist,build --show-source --statistics
- step:
name: Deploy to Development
deployment: Development
image: google/cloud-sdk:latest
caches:
- docker
script:
- echo ${KEY_FILE_AUTH} | base64 --decode --ignore-garbage > /tmp/gcloud-api.json
- gcloud auth activate-service-account --key-file /tmp/gcloud-api.json
- gcloud config set project PROJECT
- gcloud builds submit --tag eu.gcr.io/PROJECT/APP
- gcloud beta run deploy APP --image eu.gcr.io/PROJECT/APP --platform managed --region europe-west2 --allow-unauthenticated
options:
docker: true
My Dockerfile:
# syntax=docker/dockerfile:1
FROM python:3.9
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . .
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
and, the error from bitbucket pipelines:
Uploading tarball of [.] to [gs://PROJECT_cloudbuild/source/1645481495.615291-f6c287df7e6d4fd8991bed1fe6a5b9ca.tgz]
ERROR: (gcloud.builds.submit) PERMISSION_DENIED: The caller does not have permission
I don't know which permission I am missing - if anyone can give any pointers on this, that would be awesome!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
