-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 685 Bytes
/
Copy pathDockerfile
File metadata and controls
34 lines (23 loc) · 685 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
# Root Dockerfile for Shortify Project
FROM node:20-alpine AS build
WORKDIR /app
# Install frontend dependencies and build assets
COPY frontend/package*.json ./frontend/
RUN cd frontend && npm ci
COPY frontend/ ./frontend/
ARG VITE_API_URL=http://localhost:5000
ENV VITE_API_URL=$VITE_API_URL
RUN cd frontend && npm run build
# Backend production image
FROM node:20-alpine AS runner
WORKDIR /app
COPY backend/package*.json ./backend/
RUN cd backend && npm ci --omit=dev
COPY backend/ ./backend/
# Copy built frontend assets
COPY --from=build /app/frontend/dist ./frontend/dist
EXPOSE 5000
ENV NODE_ENV=production
ENV PORT=5000
WORKDIR /app/backend
CMD ["node", "server.js"]