-
-
Save Datnguyen2k/af190227f547bf61f4e869d5af7ebc03 to your computer and use it in GitHub Desktop.
Simple Dockerfile setup for a Vite app served using Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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;"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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