-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 719 Bytes
/
Dockerfile
File metadata and controls
34 lines (23 loc) · 719 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
33
34
# 1 .Building a Vue project
FROM node:20-alpine AS builder
WORKDIR /app
# Copie package.json and package-lock.json
COPY package*.json ./
# Installing dependencies
RUN npm ci
# Copying the entire project
COPY . .
ARG VITE_API_URL
RUN echo "VITE_API_URL=${VITE_API_URL}" > .env.production
# Building a project for production
RUN npm run build
# ---------- 2. Production image with Nginx ----------
FROM nginx:stable-alpine
# Copying the custom Nginx config
COPY --from=builder /app/dist /usr/share/nginx/html
# Copying the assembled frontend from the build stage
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Exhibiting the port
EXPOSE 80
# Running Nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]