-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 711 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (22 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Stage 1: Build stage
FROM node:22-alpine AS build
WORKDIR /app
# Copy package files and install dependencies
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the application files
COPY . .
# Build the React application
# Allow setting VITE_API_URL at build time, defaulting to the localhost backend
ARG VITE_API_URL=http://localhost:8080/api
ENV VITE_API_URL=$VITE_API_URL
RUN npm run build
# Stage 2: Serve stage
FROM nginx:alpine
# Copy custom nginx configuration for React routing
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy build artifacts from stage 1
COPY --from=build /app/dist /usr/share/nginx/html
# Expose port 80
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]