/image-vite

Base image for Vite apps

Primary LanguageShell

Node.js image for Vite apps

This is a Node.js base image for Cloudy

Usage

First, create a project:

  • main.ts:
import { createApp } from "vue";
import App from "./App.vue";

createApp(App).mount("#app");
  • index.html
<div id="app"></div>
<script type="module" src="src/main.ts"></script>
  • App.vue
<template>
  <div>Hello, {{ name }}!</div>
</template>

<script setup>
const name = 'world';
</script>

Then run a build

docker run --rm -v $PWD:/home/app ghcr.io/cloud-cli/vite:latest build

Creating a container

After build, create a Dockerfile

FROM ghcr.io/cloud-cli/node:latest
ADD . /home/app

Then build the image:

docker build -t my-app .

The app is now ready to run or publish!

Run app preview

docker run --rm -p 80:8080 -e PORT=8080 -v $PWD:/home/app ghcr.io/cloud-cli/vite:latest preview