-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (26 loc) · 791 Bytes
/
Dockerfile
File metadata and controls
37 lines (26 loc) · 791 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
35
36
37
# --- Build stage ---
FROM docker.io/node:lts-alpine3.19 AS builder
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Install deps
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
# Set production environment variables
ENV NODE_ENV=production
ENV VITE_API_BASE_URL=https://codelabs.bucaramanga.upb.edu.co/api/v1
# Local api
# ENV VITE_API_BASE_URL=http://codelabs.bucaramanga.upb.edu.co:8080/api/v1
COPY . .
RUN pnpm build
# --- Run stage ---
FROM docker.io/nginx:1.25.3-alpine3.18-slim AS runner
# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom nginx config
COPY ./config/default.nginx.conf /etc/nginx/conf.d
# Copy built files
COPY --from=builder /app/dist /usr/share/nginx/html
# Run nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]