forked from outpoot/bliptext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (57 loc) · 1.83 KB
/
Dockerfile
File metadata and controls
73 lines (57 loc) · 1.83 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# syntax = docker/dockerfile:1
# Base Node.js stage
FROM node:20-slim AS base-node
WORKDIR /app
ENV NODE_ENV="production"
# Base Bun stage for websocket
FROM oven/bun:latest AS base-bun
WORKDIR /app
# Build stage for main app
FROM base-node AS build-main
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
node-gyp \
pkg-config \
python-is-python3 && \
rm -rf /var/lib/apt/lists/*
COPY package*.json ./
RUN npm ci --include=dev
COPY .env .env
COPY . .
RUN npm run build
RUN npm prune --omit=dev
# Build stage for websocket
FROM base-bun AS build-websocket
WORKDIR /app
# Copy package files and install dependencies
COPY websocket/package.json websocket/bun.lockb ./
RUN bun install --production # Install only production deps
# Copy shared library files
COPY src/lib/shared ./src/lib/shared/
# Copy websocket source files
COPY websocket/src ./websocket/src/
# Production stage for main app
FROM base-node AS production-main
WORKDIR /app
COPY --from=build-main --chown=node:node /app/build ./build
COPY --from=build-main --chown=node:node /app/node_modules ./node_modules
COPY --from=build-main --chown=node:node /app/package.json .
USER node
EXPOSE 3000
CMD ["node", "build/index.js"]
# Production stage for websocket
FROM base-bun AS production-websocket
WORKDIR /app
# Copy dependencies from build stage
COPY --from=build-websocket /app/node_modules ./node_modules
# Copy shared library files
COPY --from=build-websocket /app/src/lib/shared ./src/lib/shared/
# Copy websocket source files into /app/src
COPY --from=build-websocket /app/websocket/src ./src/
EXPOSE 8080
# Debug file structure (optional, can be removed after verification)
RUN ls -la /app/src/lib/shared/
RUN ls -la /app/src/
# Command should now work with the updated import path in main.ts
CMD ["bun", "run", "src/main.ts"]