-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
53 lines (35 loc) · 1.05 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
# ===============================================================================
# BUILDER PHASE
# ===============================================================================
FROM alpine:latest as builder
RUN set -xe
RUN apk add --no-cache \
curl \
bash
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /server
COPY package.json .
COPY bun.lockb .
COPY ./src ./src
COPY tsconfig.json .
COPY tsconfig.build.json .
RUN bun install && bun build:app
RUN echo "Build completed!"
# ===============================================================================
# PRODUCTION PHASE
# ===============================================================================
FROM alpine:latest as production
RUN set -xe
RUN apk add --no-cache \
curl \
bash
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /server
COPY --from=builder ./server/node_modules ./node_modules
COPY --from=builder ./server/bun.lockb .
COPY --from=builder dist .
COPY .env .
COPY pm2.config.js .
RUN bun install pm2
CMD ["pm2", "start", "pm2.config.js"]
EXPOSE 8000