labnotes

Deploying static vite site on fly

silly silly

tags
flyio
static_sites

Contents

This is sort of silly, but since I'm deploying something else on fly.io I might as well keep everything together.

We are going to use pierrezemb/gostatic to hold the files, but build our javascript front end into the dist directory first. It will get the enviroment variables from .env.production:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
FROM node:20 as build

WORKDIR /app

COPY package* ./
RUN npm i

COPY . .
RUN npm run build

FROM pierrezemb/gostatic
COPY --from=build /app/dist/ /srv/http/

Now we have a nice and tiny little image. Lets create the fly app:

1
  fly launch --no-deploy

Edit the fly.toml file to switch the internal port to 8043

1
2
3
4
5
6
[[services]]
  http_checks = []
  internal_port = 8043
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

And then fly deploy

Previously

fragments

Discovering idagio

tags

Next

labnotes

Leaflet markers with vite build

tags
leaflet
vite