Skip to content

Deploying a Go app to Fly.io with PB-as-a-framework, and correctly mounting pb_public #4874

Answered by bogdano
bogdano asked this question in Q&A
Discussion options

You must be logged in to vote
ARG GO_VERSION=1
FROM golang:${GO_VERSION}-bookworm as builder

WORKDIR /usr/src/app
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN go build -v -o /run-app .

FROM debian:bookworm

COPY --from=builder /run-app /usr/local/bin/
COPY ./pb_public /pb/pb_public
CMD ["run-app", "serve", "--http=0.0.0.0:8080"]

OMFG I was so close the entire time. Just copy it over to /pb/pb_public/... And then set:

e.Router.GET("/*", apis.StaticDirectoryHandler(os.DirFS("/pb/pb_public"), false))

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bogdano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant