#Go Deploy Gone Wrong
38 messages · Page 1 of 1 (latest)
Project ID: 3a924444-5f7c-477b-a993-438ff0417e6d
3a924444-5f7c-477b-a993-438ff0417e6d
service id: f4b778dc-aa7e-4d96-acf0-53e538f72d79
what a title lol
send the dockerfile please?
would you mind wrapping that in triple backticks
ofc...
# Use the specific Go 1.20 image as the base image
FROM golang:1.20
# Set the working directory inside the container
WORKDIR /app
# Copy the Go module files to the working directory
COPY go.mod go.sum ./
# Download the Go module dependencies
RUN go mod download
# Copy the rest of the application source code to the working directory
COPY . .
# Build the Go application
RUN go build -o colosseum ./internal/cmd/colosseum
# Set the port number that the container should expose
ENV PORT 8080
# Expose the port on which the application will listen
EXPOSE $PORT
# Set the command to run when the container starts
CMD ["./colosseum"]
yeah that looks like a perfectly good dockerfile, very similar to the one I use, what exactly is failing?
[6/6] RUN go build -o colosseum ./internal/cmd/colosseum:
0.294 stat /app/internal/cmd/colosseum: directory not found
-----
wanna try ./... instead of that path?
to clarify
RUN go build -o colosseum ./...
?
yep
hmmm
#9 [5/6] COPY . .
#9 DONE 0.0s
#10 [6/6] RUN go build -o colosseum ./...
#10 0.698 go: cannot write multiple packages to non-directory colosseum
#10 ERROR: process "/bin/sh -c go build -o colosseum ./..." did not complete successfully: exit code: 1
yeah its a weird one
I'm hmmm'ing too
appreciate the quick response, FWIW, I have tried things like deleting the project/service in case there was some weird caching of the context etc but no luck
I wouldn't be able to share the repo but I can promise that the structure is correct
e.g:
├── internal
│ ├── cmd
│ │ └── colosseum
│ │ └── main.go
maybe it's because you have a folder named colosseum and are trying to output the binary as colosseum too
change the output bin to just app or something
🤞
Dang, I tried
ls -la /app/internal/cmd && ls -la /app/internal/cmd/colosseum
inside the Dockerfile and somehow that dir is actually not there, super weird but nothing in the dockerignore and works just fine locally...
I'm not just saying this, but that was my first thought, I really don't know why I didn't say anything
also, why dockerignore instead of just a .gitignore, do you have things you want in the repo and not in the image?
I was using the railway cli to test, does that also ignore .gitignore when building? (wasn't sure) but I see your point, but just for sanity, I removed both but the issue remains
the cli will omit tarballing files/folders based on rules in either a .gitignore or a .railwayignore file
ah nice, good to know
I know you've shown me a tree, but if you'd provide me with a repo that has a minimal reproducible example, id be happy to debug it myself too
Will do, let me try and put something together!
sounds good
of course the repro attempt actually works RIP
lmao make it not work