Home > Net >  Where will I find the source code for Google App Engine Flexible environment?
Where will I find the source code for Google App Engine Flexible environment?

Time:06-17

I want to download the source code in my Python 3 App Engine flexible environment. I see how you can SSH in, or go in from the terminal, to look at source code. But I don't want to turn debug on a production machine. Instead, is it possible to just list the files, and then download to my machine?

The app was uploaded using Docker, pushed to gcr.io, and deployed with gcloud app deploy.

CodePudding user response:

I managed to copy the source code from the App Engine Flex environment by following these steps:

  1. Fetch the App Engine image to be used by performing either the following:

    • Navigate to Google Container Registry then select appengine
    • Typing gcloud container images list --repository [region]/[project-name]/appengine in Cloud Shell

    Supported regions:

    • gcr.io
    • us.gcr.io
    • eu.gcr.io
    • asia.gcr.io
  2. Create a container using Docker:

    docker create --name=gae-source [region]/[project-name]/appengine/[service].[version]:[tag]

    It would be easier to copy the full repository name then add the tags afterwards by clicking the copy 2 button beside the repository name or service.version.

  3. Copy the files from the docker container:

    docker cp gae-source:/app . --follow-link

  4. Check if the files are successfully copied:

    ls ./app

  5. Compress the files by performing:

    tar -czvf app.tar.gz ./[folder]

  6. You may now download the compressed file on your local machine.

I managed to view the source code by using the Cloud Shell Editor. I didn't have to download the files.

You can check this Github link that I followed.

  • Related