feat(docker): Deploy frontend from express
This commit is contained in:
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
||||
# --- Build frontend ---
|
||||
FROM node:24-slim AS frontend-builder
|
||||
WORKDIR /frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm install
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# --- Backend setup ---
|
||||
FROM node:24-slim
|
||||
|
||||
# Install ping for backend
|
||||
RUN apt-get update && \
|
||||
apt-get install -y iputils-ping && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy backend code
|
||||
COPY backend/package*.json ./
|
||||
RUN npm install
|
||||
COPY backend/ .
|
||||
|
||||
# Copy built frontend into backend expected location
|
||||
COPY --from=frontend-builder /frontend/dist /frontend/dist
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
Reference in New Issue
Block a user