-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (36 loc) · 938 Bytes
/
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
# Stage 1: Build stage
FROM alpine:latest AS builder
ENV NODE_ENV=production
ENV LIBREOFFICE=libreoffice
RUN apk add --no-cache \
bash \
curl \
npm \
libc6-compat
RUN curl -fsSL https://bun.sh/install | bash && \
ln -s /root/.bun/bin/bun /usr/local/bin/bun
WORKDIR /app
COPY . .
# Avoid "/bin/bash: line 1: husky: command not found"!
RUN bun install husky
RUN bun install --production
# Stage 2: Runtime stage
FROM alpine:latest
ENV NODE_ENV=production
ENV LIBREOFFICE=libreoffice
RUN apk add --no-cache \
bash \
curl \
libreoffice \
ttf-freefont \
font-noto \
font-noto-cjk \
font-noto-emoji
WORKDIR /app
COPY --from=builder /app /app
# Copy the bun binary from the build stage to runtime
COPY --from=builder /root/.bun /root/.bun
RUN ln -s /root/.bun/bin/bun /usr/local/bin/bun
RUN echo "export LIBREOFFICE=\${LIBREOFFICE:-libreoffice}" >> /etc/profile.d/libreoffice.sh
EXPOSE 3000
CMD ["bun", "run", "start"]