My Project isn't Deploy. I think it has problem with dockerfile
hi brothers i have a problem that #14 [stage-0 8/8] RUN --mount=type=cache,id=s/8f06eb4a-56be-4f8f-aa58-85389970dcf7-/root/cache/go-build,target=/root/.cache/go-build go build -o out
#14 0.723 no Go files in /app
#14 ERROR: process "/bin/bash -ol pipefail -c go build -o out" did not complete successfully: exit code: 1
-----
[stage-0 8/8] RUN --mount=type=cache,id=s/8f06eb4a-56be-4f8f-aa58-85389970dcf7-/root/cache/go-build,target=/root/.cache/go-build go build -o out:
0.723 no Go files in /app
-----
Dockerfile:23
-------------------
21 | # build phase
22 | COPY . /app/.
23 | >>> RUN --mount=type=cache,id=s/8f06eb4a-56be-4f8f-aa58-85389970dcf7-/root/cache/go-build,target=/root/.cache/go-build go build -o out
24 |
25 |
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c go build -o out" did not complete successfully: exit code: 1
Error: Docker build failed
9 Replies
Project ID:
8f06eb4a-56be-4f8f-aa58-85389970dcf7,8f06eb4a-56be-4f8f-aa58-85389970dcf7,8f06eb4a-56be-4f8f-aa58-85389970dcf7
What does your file-tree look like?
like this
You have no Go files in your root directory
by default Go tries checking for Go files in the root directory but since there isn't any it fails
I believe you'll need to specify the directory containing your Go files for your build command ( you can specify a custom build command in service settings )
my main.go files located in cmd folder so i have to change it. Am i right?
I think so, I don't actually use Go at all - but based on a quick google search that seems like the correct solution
The only reason you have to change, is becuase you don't have a build script. So it just defaults to the most common structure.
You can either match that structure, or you can add a build script (a Dockerfile, a nixpacks file, or even a railway.json file)
you can also simply update the build command in your service settings
thank you so much. I am so happy