A static server (designed for Vite) that allows environment variables to be subsisted at runtime.
512
A dead simple static site server (designed for Vite projects) that allows environment variables to be subsisted at runtime.
FROM node:18-alpine as build
WORKDIR /usr/app
COPY . /usr/app
RUN yarn
RUN yarn build
FROM georgecraggs/vite-server:1
COPY --from=build /usr/app/dist /dist
.env.development so I can
easily test the project in development mode.During the build process, Vite will do string replacements of any uses of environment variables that start with "VITE_" to match the value at build time.
If an environment variable isn't set, it will replace "import.meta.env" with "{}".
For each environment variable beginning with "VITE_" we do a find/replace for "{}.VITE_...". If any replacements are made in the file it's cached in memory, so we don't have to perform the replacements for every request.
Content type
Image
Digest
sha256:f4adcf9bd…
Size
7.8 MB
Last updated
almost 2 years ago
docker pull georgecraggs/vite-server