Gatsby + Fly stack?

Last question -

Any ideas/optimizations for a GatsbyJS + Fly.io stack? The article about Hugo and Fly was very helpful, but has anyone shipped the output from GatsbyJS to Fly?

Oh this will work really well for Gatsby: https://fly.io/blog/serve-small-with-fly-io-and-gostatic/

They have a build image you can use for this, I think if you do this Dockerfile it might just work for any ol’ Gatsby project:

FROM gatsbyjs/gatsby:onbuild as build

FROM pierrezemb/gostatic
COPY --from=build /app/public/* /srv/http/
1 Like

Here’s a quick example.

Dockerfile:

    FROM node:13-buster-slim as build
    WORKDIR /app
    RUN yarn global add gatsby-cli && gatsby telemetry --disable
    ADD package.json yarn.lock ./
    RUN yarn --production --frozen-lockfile --non-interactive
    ADD . ./
    RUN gatsby build
    FROM pierrezemb/gostatic
    COPY --from=build /app/public /srv/http
    EXPOSE 8043

.dockerignore

    .cache/
    node_modules/
    public/

in the gatsby site directory for both, then

flyctl init -p 8043
flyctl deploy

and get a nice cup’o’joe…

1 Like