Skip to content

Instantly share code, notes, and snippets.

@Datnguyen2k
Forked from nphamvn/Dockerfile
Created June 9, 2025 14:46
Show Gist options
  • Save Datnguyen2k/af190227f547bf61f4e869d5af7ebc03 to your computer and use it in GitHub Desktop.
Save Datnguyen2k/af190227f547bf61f4e869d5af7ebc03 to your computer and use it in GitHub Desktop.
Simple Dockerfile setup for a Vite app served using Nginx
FROM node:21-alpine3.18 as build
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:1.25-alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri /index.html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment