Search code examples
google-app-engineapp-engine-flexible

App Engine Flex custom - missing project files in Dockerfile build process


I'm trying to deploy Java app using App Engine Flex, but unfortunately - when deployment comes to stage when Docker image is being built, it seems to be ran in some isolated environment, and not in my local directory, with all required files for build process.

My app.yaml file looks like this:

service: default
env: flex
runtime: custom
handlers:
  - url: .*
    script: auto
manual_scaling:
  instances: 1
network: {}

And my Dockerfile:

FROM openjdk:11-jre-slim
ADD . /app
WORKDIR /app
RUN ls -halt
CMD ["java", "-jar", "app.jar"]

I'm running commands:

gcloud auth activate-service-account --key-file mykeyfile.json
gcloud --quiet --project myprojectname app deploy app.yaml

mykeyfile.json holds credentials for Service Account with Owner role.

Command RUN ls -halt displays, that directory is empty - no files were copied from my machine.

How can I provide required files to be used during Docker image build?


Solution

  • Make sure that the files that are missing from the deploy are not listed in your .gcloudignore file.

    As per the .gcloudignore documentation:

    If there is a file called .gcloudignore in the top-level directory to upload, the files that it specifies will be ignored.

    Maybe during the deploy the files/directories were added to the .gcloudignore file by mistake, so by removing the files you desire to be deployed from the .gcloudignore file you will be able to do so.