This repository provides a reference on how to create a Docker image for client-side applications built with frameworks like React, Vite, etc. The goal is to create a minimal and efficient Docker image. To achieve this, we use static-web-server to serve the final build files, ensuring the image remains small and lean.
static-web-server
is a fast and efficient web server written in Rust, designed specifically for serving static files. It is chosen for this project because:
- It is fast and lightweight, contributing to a smaller Docker image.
- It provides useful features out-of-the-box like gzip compression, HTTP/2, and customizable headers.
-
Clone this repository
git clone https://github.com/Trugamr/vite-docker-static-web-server.git cd vite-docker-static-web-server
-
Build the Docker image
docker build -t vite-docker-static-web-server .
-
Run the Docker container
docker run --rm -p 8080:80 vite-docker-static-web-server
The application will be available at http://localhost:8080.
This project is licensed under the MIT License.
For more information on how to use static-web-server
, refer to the official documentation or the GitHub repository.