Skip to content

Ensure COPY . . is working correctly in custom workspace images #7945

Open
@Furisto

Description

@Furisto

Bug description

Some users get a file name too long error when building images if they have specified COPY . .

Steps to reproduce

  • The content of the customer repository is initialized under /workspace e.g.
COPYING.txt         VERSION.txt         condarc.yml         pkgs                tox.ini
Makefile            bootstrap           configure.ac        pyrightconfig.json
Pipfile.m4          build               docker              sage
README.md           buildkit            m4                  src
  • The root directory for buildkit (which is used by buildkit to store the layers of the container image that is build) is located at /workspace/buildkit
  • The context for the image build is /workspace
buildctl build --progress=plain --output=type=image,name=localhost:8080/base:latest,push=true,oci-mediatypes=true --local=context=/workspace --frontend=dockerfile.v0 --local=dockerfile=/workspace/docker --opt=filename=.gitpod.Dockerfile
  • The dockerfile for the image build specifies COPY . . somewhere
  • The context of the docker build contains the buildkit directory itself -> The buildkit directory is used to store the context -> COPY . . copies everything including the buildkit directory. This leads to a recursive copy of the build context which gets bigger and bigger with each pass until it hits the storage quota and the build fails.

Workspace affected

n.a.

Expected behavior

Image build should be executed successfully.

Example repository

https://github.com/Furisto/sagetrac-mirror

Anything else?

There are several ways to solve this issue:

  • Put the buildkit directory somewhere else e.g. under /tmp. We have to check how well this works with ephemeral storage limits.
  • Use a .dockerignore file to exclude the buildkit directory. The customer might already have a .dockerignore, but it is possible to specify our own during build. We would need to create a new .dockerignore which contains the content of the customer .dockerignore + our own exclusions.
  • Adapt the builder-mk3 to adapt the Initializer, Context and Dockerfile arguments.

Related issues

#7602
#7157

Front logo Front conversations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions