0

This project have used google cloud builder since 2 month ago. However the build is fail since yesterday.

The error point is COPY . /code/. It's get this error.

COPY . /code/                                
error building image: error building stage: failed to execute command: lstat /Users: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/kaniko-project/executor:latest" failed: step exited with non-zero status: 1
--------------------------------------------------------------------------------------------------------------------

ERROR: (gcloud.builds.submit) build ab3ff4e4-85fb-4000-870e-86f34c0bf8ac completed with status "FAILURE"

Dockerfile is below

# Copyright 2013 Thatcher Peskens
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM python:3

MAINTAINER Dockerfiles


# timezone setting
RUN DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y tzdata
# timezone setting
ENV TZ=Asia/Tokyo 


# Install required packages and remove the apt packages cache when done.

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y \
    vim \
    python3 \
    python3-dev \
    python3-setuptools \
    python3-pip \
    libssl-dev \
    nginx \
    supervisor \
    cron \
    && \
   rm -rf /var/lib/apt/lists/*

RUN pip3 install --upgrade pip
RUN pip3 install -U pip setuptools


# encode setting
# set the locale
RUN apt-get clean && apt-get update && apt-get install -y locales
# encode and locale settings
ENV LANG ja_JP.utf8
ENV TZ=Asia/Tokyo

#don't show error message
ENV DEBCONF_NOWARNINGS yes

# install uwsgi now because it takes a little while
RUN pip3 install uwsgi

RUN PYTHONPATH=/usr/bin/python3

RUN echo "daemon off;" >> /etc/nginx/nginx.conf
COPY nginx-app.conf /etc/nginx/sites-available/default
COPY supervisor-app.conf /etc/supervisor/conf.d/
COPY cron/crontab /var/spool/cron/crontabs/root

# COPY requirements.txt and RUN pip install BEFORE adding the rest of your code, this will cause Docker's caching mechanism
# to prevent re-installing (all your) dependencies when you made a change a line or two in your app.

COPY app/requirements.txt /code/app/
RUN pip3 install -r /code/app/requirements.txt

# add (the rest of) our code
COPY . /code/

RUN chmod 0744 /code/cron/*
RUN crontab /code/cron/crontab

ENV PYTHONPATH /usr/bin/python3

# install django, normally you would remove this step because your project would already
# be installed in the code/app/ directory
#RUN django-admin.py startproject website /code/app/

# this line do collectstatic and migrate
#RUN cd /code/app && /usr/bin/python3 manage.py collectstatic --no-input;/usr/bin/python3 manage.py migrate;

EXPOSE 8080
CMD ["supervisord", "-n"]

I build by this command.

cd ~/path/to/project/
gcloud builds submit --tag gcr.io/my/project . 

What I did

  • COPY . /code/ move to after FROM python:3
  • COPY . /code/ change to COPY . /code/
  • COPY . /code/ change to COPY ./ /code/
  • COPY . /code/ change to COPY ./* /code/
  • COPY . /code/ change to ADD . /code/

Everything got same error at the line.

When I build at local docker build -t my_project ., it was completed.

Environment

  • gloculd core: [2020.02.28] beta: [2019.05.17]
  • macOS 10.14.6

If you have any solution, please help me!

3
  • Can you try to remove the dot at the end of this command: gcloud builds submit --tag gcr.io/my/project .? Commented Mar 8, 2020 at 19:07
  • If it's not better, can you tell me if you have a .gitignore or a .gcloudignore file? If so, can you share their content? Commented Mar 8, 2020 at 19:09
  • I run by gcloud builds submit --tag gcr.io/my/project. It has same error. Sorry I can't share my content. Commented Mar 9, 2020 at 1:46

1 Answer 1

1

I solved this problem. The solution is copy each files and directorys. This is my files.

enter image description here

I changed COPY . /code/ to select each file.

COPY app/manage.py /code/app/
COPY app/affiliator/ /code/app/affiliator/
COPY app/post/ /code/app/post/
COPY app/assets/ /code/app/assets/
COPY app/media/ /code/app/media/
COPY app/website/ /code/app/website/
COPY app/owner/ /code/app/owner/
COPY app/base/ /code/app/base/
COPY cron/ /code/cron/
COPY uwsgi.ini /code/
COPY uwsgi_params /code/

However, this is a coping treatment and the underlying cause is unknown.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.