-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (56 loc) · 1.5 KB
/
Dockerfile
File metadata and controls
73 lines (56 loc) · 1.5 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
FROM node:22-alpine AS builder
WORKDIR /build
RUN npm install -g turbo pnpm
COPY *.json ./
COPY pnpm*.yaml ./
COPY apps/web/package*.json ./apps/web/
COPY apps/server/package*.json ./apps/server/
RUN pnpm install
COPY . .
RUN pnpm run build
FROM docker:dind AS runner
RUN apk add --no-cache nodejs npm
WORKDIR /app
COPY --from=builder /build/apps/server/dist ./server
COPY --from=builder /build/apps/server/package.json ./server
COPY --from=builder /build/apps/server/src/dockerfile ./server/src/dockerfile
COPY --from=builder /build/apps/web/dist ./web/dist
ENV PORT=8000
ENV ORIGIN=http://localhost:3000
ENV VITE_SERVER_URL=http://localhost:8000
RUN cd ./server && npm install -prod
RUN cd ./web && npm install serve
RUN echo '{\
"name": "web", \
"version": "0.0.0", \
"private": true, \
"type": "module", \
"scripts": { \
"start": "npx serve -s dist -l 3000"\
} \
}' > ./web/package.json
RUN npm install concurrently
RUN echo '{ \
"name": "compilerz", \
\
"version": "1.0.0", \
\
"private": true, \
\
"scripts": { \
"start": "concurrently --kill-others --names \"SERVER,WEB\" --prefix-colors \"red,blue\" \"npm run start --workspace=server\" \"npm run start --workspace=web\"" \
}, \
\
"devDependencies": { \
\
"concurrently": "^8.2.2" \
}, \
\
"workspaces": [ \
"web", \
"server" \
], \
"author": "arshGoyalDev", \
"license": "MIT" \
}' > ./package.json
CMD ["npm", "run", "start"]