Compare commits
6 Commits
live-api-c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d42e156a2 | |||
| c8e51a188c | |||
| 6f5f3d50d3 | |||
| 9dfcea815e | |||
| 4c52ef780d | |||
| 4dd326fa38 |
26
Dockerfile
Normal file
26
Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
# Stage 1: Build the React application
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy lock files and install dependencies
|
||||
COPY package*.json yarn.lock* package-lock.json* ./
|
||||
RUN npm install
|
||||
|
||||
# Copy codebase and compile Vite project
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Serve using Nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy custom Nginx configuration
|
||||
COPY nginx.config /etc/nginx/nginx.conf
|
||||
|
||||
# Copy Vite's dist output from Stage 1 to Nginx default html path
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
17
nginx.config
Normal file
17
nginx.config
Normal file
@@ -0,0 +1,17 @@
|
||||
events {}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
server {
|
||||
listen 3000;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user