-
-
Notifications
You must be signed in to change notification settings - Fork 95
/
Dockerfile
57 lines (41 loc) · 1.29 KB
/
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
FROM node:22 as builder
ARG CDN_URL
ENV PUBLIC_CDN_URL=$CDN_URL
WORKDIR /usr/src/app
RUN npm i -g bun
FROM builder AS install
RUN mkdir -p /temp/dev
COPY . /temp/dev/
RUN cd /temp/dev && bun install
FROM builder AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
RUN mkdir .undb
ENV NODE_ENV=production
ENV PORT=3721
RUN bun run build:docker
RUN rm -rf node_modules
RUN bun install --production
# Add Tini init-system
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini
RUN chmod +x /tini
FROM oven/bun AS release
ENV NODE_ENV=production
ENV PORT=3721
WORKDIR /usr/src/app
RUN mkdir .undb
RUN mkdir .undb/storage
COPY --from=prerelease /usr/src/app/apps/backend/undb .
COPY --from=prerelease /usr/src/app/node_modules ./node_modules
COPY --from=prerelease /usr/src/app/apps/backend/drizzle ./drizzle
COPY --from=prerelease /usr/src/app/apps/backend/assets ./assets
COPY --from=prerelease /usr/src/app/apps/backend/src/modules/mail ./mail
COPY --from=prerelease /usr/src/app/packages ./packages
COPY --from=prerelease /usr/src/app/package.json .
COPY --from=prerelease /usr/src/app/apps/frontend/dist ./dist
COPY --from=prerelease /tini /tini
# run the app
EXPOSE 3721/tcp
ENTRYPOINT ["/tini", "--"]
CMD [ "./undb" ]