Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Run: COPY fails when changing source folder from ./ to build

$ gcloud builds submit --tag gcr.io/projectname/testserver
// ... works fine until the COPY step:

Step 6/7 : COPY build ./
COPY failed: stat /var/lib/docker/tmp/docker-builder653325957/build: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 1

That build folder listed above, /var/lib/docker/tmp/docker-builder653325957/build, is not a local folder. Does Cloud Builder create a temp folder in that format?

How do I get it to copy my local build folder?

I also tried COPY ./build ./ but the CLI output was the same

Dockerfile below.

FROM node:12-slim

# Create app folder
WORKDIR /usr/src/app

# Install app deps. Copy the lock file
COPY package*.json ./
RUN npm install

ENV SCOPES=removed \
    SHOPIFY_API_KEY=removed \
    SHOPIFY_API_SECRET=removed \
    CLIENT_APP_URL=removed

COPY build ./
CMD ["node", "server.js"]


like image 584
Sean D Avatar asked Feb 01 '20 20:02

Sean D


1 Answers

The gcloud command uses the .gitignore and .gcloudignore files to determine which files and directories to include with the Docker build. If your build directory is listed in either of these files, it won't be available to copy into your container image.

like image 50
Dustin Ingram Avatar answered Sep 24 '22 01:09

Dustin Ingram