https://pulumi.com logo
#general
Title
# general
q

quiet-helmet-40109

07/10/2023, 2:25 PM
Hi guys, having issues with docker build:
stat cannot find Dockerfile: No such directory or folder
This is our code:
Copy code
export const myImage = new docker.Image(
    myAppImageName,
    {
        imageName: pulumi.interpolate`${region}-docker.pkg.dev/${artifactRegistry.project}/${artifactRegistry.repositoryId}/${myAppImageName}`,
        build: {
            args: imageArgs,
            platform: "linux/amd64",
            context: "../",
            dockerfile: "../Dockerfile.gcp_web",
        },
    },
    { dependsOn: [artifactRegistry, elastic.instance] }
);
Any ideas?
docker build .. -f ../Dockerfile.gcp_web
<---- this is working just fine in the same directory
p

prehistoric-activity-61023

07/10/2023, 2:31 PM
What’s the directory structure? Can you tell us how those things are located in reference to each other: • Pulumi.yaml • source file (the one containing the code snippet mentioned above) • Dockerfile How do you run pulumi CLI (from what directory) on the top of that?
if you’re on linux-like platform, try to run
tree
in the command line 🙂
I’ve never used
docker
package but I have a strange feeling that using
../
might be not allowed 🤔
or if it is, it might be an issue with “current working directory”, relative paths can be resolved based on: • Pulumi.yaml (project file) • current working directory in which you run
pulumi up
• the actual file containing the rel path
q

quiet-helmet-40109

07/10/2023, 2:40 PM
This is my structure: project/ -ops(Folder) -> here is the Pulumi.yaml --resources(Folder) -> here is the actual pulumi docker code --index.ts --Pulumi.yaml DockerFile -> the docker file we need tu build DockerFile is inside project root folder. We run
pulumi up
command inside
ops
folder. So that’s why we are using
../
as context and
../DockerFile
as it’s actually the relative path (one up from ops, where we run the command) we already tried with one more directory but it didn’t work. (Expecting to use resources as the current path from pulumi) We also logged the
__dirname
and
pwd
and everything points to
ops
folder, where we are standing.
p

prehistoric-activity-61023

07/10/2023, 2:43 PM
can you try to move the Dockerfile to
ops
folder, change the code accordingly and run
pulumi up
again to see if the error persists?
it’s possible that the package cannot move outside of the pulumi project dir (that’s just my blind guess, assuming you haven’t done any silly mistake)
let me try to quickly check sth in my machine
q

quiet-helmet-40109

07/10/2023, 2:48 PM
We found the issue, and it’s not related to the dockerfile (as the error says) It’s related to some dependency (elastic search) not being able to be resolved……. We are going to investigate further and upload an issue to pulumi github
Thanks a lot @prehistoric-activity-61023! party pizza
p

prehistoric-activity-61023

07/10/2023, 2:49 PM
I feel like I did nothing to help you but I’m glad to hear you managed to find the root cause 🙂
please post here a link to the issue when you report it 🙏
2 Views