-
Notifications
You must be signed in to change notification settings - Fork 301
/
all.Dockerfile
105 lines (73 loc) · 2.93 KB
/
all.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Run `docker login`, use jitsucom account
# Build & push it with
# docker buildx build --platform linux/amd64 . -f console.Dockerfile --push -t jitsucom/console:latest
FROM node:22.8-bookworm as base
WORKDIR /app
RUN apt-get update -y
RUN apt-get install nano curl cron bash netcat-traditional procps jq -y
FROM base as builder
RUN apt-get update -y
RUN apt-get install git openssl1.1 procps python3 make g++ -y
RUN npm -g install pnpm
# Create app directory
WORKDIR /app
COPY pnpm-lock.yaml .
RUN --mount=type=cache,id=onetag_pnpm,target=/root/.local/share/pnpm/store/v3 pnpm fetch
COPY . .
RUN rm .env*
RUN --mount=type=cache,id=onetag_pnpm,target=/root/.local/share/pnpm/store/v3 pnpm install -r --unsafe-perm
ENV NEXTJS_STANDALONE_BUILD=1
#Tubo cache is not working well ?
#RUN --mount=type=cache,id=onetag_turbo,target=/app/node_modules/.cache/turbo pnpm build
RUN pnpm build
FROM base as console
ARG JITSU_BUILD_VERSION=dev,
ARG JITSU_BUILD_DOCKER_TAG=dev,
ARG JITSU_BUILD_COMMIT_SHA=unknown,
WORKDIR /app
RUN npm -g install prisma@$(cat webapps/console/package.json | jq -r '.dependencies.prisma')
COPY --from=builder /app/docker-start-console.sh ./
COPY --from=builder /app/webapps/console/prisma/schema.prisma ./
COPY --from=builder /app/webapps/console/.next/standalone ./
COPY --from=builder /app/webapps/console/.next/static ./webapps/console/.next/static
COPY --from=builder /app/webapps/console/public ./webapps/console/public
COPY --from=builder /app/console.cron /etc/cron.d/console.cron
RUN chmod 0644 /etc/cron.d/console.cron
RUN crontab /etc/cron.d/console.cron
EXPOSE 3000
HEALTHCHECK CMD curl --fail http://localhost:3000/api/healthcheck || exit 1
ENV NODE_ENV=production
ENV JITSU_VERSION_COMMIT_SHA=${JITSU_BUILD_COMMIT_SHA}
ENV JITSU_VERSION_DOCKER_TAG=${JITSU_BUILD_DOCKER_TAG}
ENV JITSU_VERSION_STRING=${JITSU_BUILD_VERSION}
ENTRYPOINT ["sh", "-c", "/app/docker-start-console.sh"]
FROM base as rotor
ARG JITSU_BUILD_VERSION=dev,
ARG JITSU_BUILD_DOCKER_TAG=dev,
ARG JITSU_BUILD_COMMIT_SHA=unknown,
WORKDIR /app
RUN addgroup --system --gid 1001 runner
RUN adduser --system --uid 1001 runner
USER runner
EXPOSE 3401
COPY --from=builder /app/services/rotor/dist .
ENV NODE_ENV=production
ENV JITSU_VERSION_COMMIT_SHA=${JITSU_BUILD_COMMIT_SHA}
ENV JITSU_VERSION_DOCKER_TAG=${JITSU_BUILD_DOCKER_TAG}
ENV JITSU_VERSION_STRING=${JITSU_BUILD_VERSION}
CMD ["--no-node-snapshot", "--max-old-space-size=2048", "main.js"]
FROM base as profiles
ARG JITSU_BUILD_VERSION=dev,
ARG JITSU_BUILD_DOCKER_TAG=dev,
ARG JITSU_BUILD_COMMIT_SHA=unknown,
WORKDIR /app
RUN addgroup --system --gid 1001 runner
RUN adduser --system --uid 1001 runner
USER runner
EXPOSE 3401
COPY --from=builder /app/services/profiles/dist .
ENV NODE_ENV=production
ENV JITSU_VERSION_COMMIT_SHA=${JITSU_BUILD_COMMIT_SHA}
ENV JITSU_VERSION_DOCKER_TAG=${JITSU_BUILD_DOCKER_TAG}
ENV JITSU_VERSION_STRING=${JITSU_BUILD_VERSION}
CMD ["--no-node-snapshot", "--max-old-space-size=2048", "main.js"]