-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (29 loc) · 761 Bytes
/
Dockerfile
File metadata and controls
41 lines (29 loc) · 761 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
# Use Node.js 18 Alpine as base image
FROM node:18-alpine AS builder
ARG VERSION=0.0.0
ENV APP_VERSION=$VERSION
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the application (frontend and server)
RUN npm run build && npm run build:server
# Production stage
FROM node:18-alpine
ARG VERSION=0.0.0
ENV APP_VERSION=$VERSION
WORKDIR /app
# Copy built assets from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY server ./server
COPY package*.json ./
RUN npm prune --production || true
# Persist application data
VOLUME /app/dist/server/data
EXPOSE 3002
CMD ["node", "dist/server/index.js"]