-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathpro.Dockerfile
68 lines (50 loc) · 1.95 KB
/
pro.Dockerfile
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
# PRO version of OpenTrader
# You must have access to the private repository to build this image
# https://github.com/bludnic/opentrader-pro
#### BASE
FROM node:latest AS base
WORKDIR /app
# Install moon binary
RUN npm install -g @moonrepo/cli
#### SKELETON
FROM base AS skeleton
# Copy entire repository and scaffold
COPY . .
# Install opentrader-pro git submodule
ARG GITHUB_TOKEN
RUN rm -rf pro
RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
RUN git clone https://github.com/bludnic/opentrader-pro.git pro
# Copy the minimum of files necessary for installing dependencies
RUN moon docker scaffold frontend processor
#### BUILD
FROM base AS build
# Copy toolchain
COPY --from=skeleton /root/.proto /root/.proto
# Copy workspace skeleton
COPY --from=skeleton /app/.moon/docker/workspace .
# Copy Prisma schema
COPY --from=skeleton /app/.moon/docker/sources/packages/prisma/src/schema.prisma ./packages/prisma/src/schema.prisma
# Install toolchain and dependencies
RUN moon docker setup
# Copy source files
COPY --from=skeleton /app/.moon/docker/sources .
# Build something (optional)
RUN moon run frontend:build processor:build
# Remove unneeded files and folders
RUN moon docker prune
##### RUNNER
FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=build /app/pro/frontend/dist ./pro/frontend/dist
COPY --from=build /app/pro/processor ./pro/processor
COPY --from=build /app/node_modules ./node_modules
# Copy Prisma schema, migrations, and seed script
COPY --from=build /app/packages/prisma/src/schema.prisma ./packages/prisma/src/schema.prisma
COPY --from=build /app/packages/prisma/src/migrations ./packages/prisma/src/migrations
COPY --from=build /app/packages/prisma/seed.mjs ./packages/prisma/seed.mjs
# Copy the entrypoint script to run migrations before starting the app
COPY bin/docker-entry.sh /app/bin/docker-entry.sh
ENTRYPOINT ["/app/bin/docker-entry.sh"]
WORKDIR /app/pro/processor
CMD node dist/main.mjs