2

Deploying static vite site on fly

 1 month ago
source link: https://willschenk.com/labnotes/2024/deploying_static_vite_site_on_fly/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Deploying static vite site on fly

silly silly

Published March 26, 2024

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:

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:

  fly launch --no-deploy

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

[[services]]
  http_checks = []
  internal_port = 8043
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

And then fly deploy


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK