What docker command is used for build

ISSUE

I have a turbo monorepo that I’m trying to deploy. It has a NextJs app inside app/web directory. This dir contains a Dockerfile.

When I deploy this to Qovery, I set the root application path to apps/web. When I deploy, I get an error as described at Prune command crashing on Windows & M1/M2 · Issue #1554 · vercel/turbo · GitHub.

When I build the image locally, by running docker build apps/web I get the same error as I get on my prod environment.

However, when I build using docker build -f apps/web/Dockerfile . I am successful. The build happens.

Question is – what command does Qovery use to build the docker image?

Screenshot 2023-04-30 at 1.18.04 AM

I found it via ChatGPT that

Question: I have a dockerfile that I am building using two different commands - " docker build -f apps/web/Dockerfile ." and “docker build apps/web”. In the first command the build succeeds, but in the second one it fails. Nothing else is changed. What could be the reason for this behavior?

The difference in behavior is likely due to the build context that is being used in each command. In Docker, the build context is the set of files and directories that are sent to the Docker daemon for use in the build process. The build context is specified by the path argument at the end of the docker build command.

  1. When you run docker build -f apps/web/Dockerfile ., you are specifying the build context as the current directory (.). The Docker daemon receives all files and directories in the current directory as the build context, and the Dockerfile is specified with the -f flag.
  2. When you run docker build apps/web, you are specifying the build context as the apps/web directory. In this case, the Docker daemon receives only the files and directories inside apps/web as the build context. The Dockerfile is expected to be in the root of the build context (i.e., apps/web/Dockerfile).
    The build failure in the second command could be due to missing files or directories that are required by the build process. These files may be present in the build context of the first command (current directory) but not in the build context of the second command (apps/web directory).
    To fix this issue, you can either:
  • Move the required files and directories to the apps/web directory, or
  • Continue using the first command with the -f flag and the build context set to the current directory.

Make sure that your Dockerfile correctly specifies any required files and directories relative to the build context that you are using.

So I changed the setting like below and it worked

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.