-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (56 loc) · 1.47 KB
/
Dockerfile
File metadata and controls
70 lines (56 loc) · 1.47 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
# Build image
FROM node:23-alpine AS build
WORKDIR /app
# Copy backend source files
COPY LICENSE \
README.md \
package.json \
package-lock.json \
tsconfig.json \
Makefile \
./
COPY src ./src
# Copy frontend source files
RUN mkdir -p ./frontend
COPY frontend/package.json \
frontend/package-lock.json \
frontend/tsconfig.json \
frontend/tsconfig.app.json \
frontend/tsconfig.node.json \
frontend/vite.config.ts \
frontend/env.d.ts \
frontend/index.html \
frontend/Makefile \
./frontend/
COPY frontend/src ./frontend/src
COPY frontend/public ./frontend/public
# Install system dependencies
RUN apk add --no-cache typescript make
# Build all
RUN make
# Remove dev dependencies
RUN npm prune --production
RUN cd frontend && npm prune --production
RUN apk del make typescript
# Web image
FROM node:23-alpine AS web
WORKDIR /app
# Copy built files
COPY --from=build \
/app/package.json \
/app/LICENSE \
/app/README.md \
./
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
# Copy frontend built files
COPY --from=build /app/frontend/dist ./frontend/dist
COPY --from=build /app/frontend/node_modules ./frontend/node_modules
COPY --from=build /app/frontend/public ./frontend/public
COPY --from=build \
/app/frontend/package.json \
/app/frontend/package-lock.json \
/app/frontend/index.html \
/app/frontend/
# Run the app
CMD ["npm", "run", "start"]