-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (36 loc) · 955 Bytes
/
Copy pathDockerfile
File metadata and controls
45 lines (36 loc) · 955 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
38
39
40
41
42
43
44
45
# Stage 1: Build Frontend
FROM node:18-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ .
RUN npm run build
# Stage 2: Final Runtime System
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies (Compilers & Runtime)
RUN apt-get update && apt-get install -y \
curl \
gnupg \
build-essential \
clang \
g++ \
openjdk-17-jdk-headless \
python3 \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Setup Backend
COPY backend/package*.json ./backend/
WORKDIR /app/backend
RUN npm ci --only=production
# Copy Backend Source
COPY backend/ .
# Copy Built Frontend from Stage 1
COPY --from=frontend-builder /app/frontend/dist ../frontend/dist
# Environment & Start
ENV PORT=5000
ENV NODE_ENV=production
EXPOSE 5000
CMD ["node", "server.js"]