31 lines
464 B
Docker
31 lines
464 B
Docker
|
|
FROM node:20-alpine as build
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Install dependencies
|
||
|
|
COPY package.json ./
|
||
|
|
RUN npm install
|
||
|
|
|
||
|
|
# Copy source
|
||
|
|
COPY . .
|
||
|
|
|
||
|
|
# Build argument for API URL
|
||
|
|
ARG VITE_API_URL=/api/v1
|
||
|
|
ENV VITE_API_URL=$VITE_API_URL
|
||
|
|
|
||
|
|
# Build
|
||
|
|
RUN npm run build
|
||
|
|
|
||
|
|
# Production stage
|
||
|
|
FROM nginx:alpine
|
||
|
|
|
||
|
|
# Copy built files
|
||
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||
|
|
|
||
|
|
# Copy nginx config
|
||
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
|
||
|
|
EXPOSE 80
|
||
|
|
|
||
|
|
CMD ["nginx", "-g", "daemon off;"]
|