-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (28 loc) · 987 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
# Use an alias for the first build stage
FROM debian:bookworm-slim as builder
# Set the working directory
WORKDIR /app
# Update, install curl, unzip, wamerican, download and install bun, and cleanup in one step
RUN apt update && \
apt install -y curl unzip wamerican && \
curl https://bun.sh/install | bash && \
apt clean && \
rm -rf /var/lib/apt/lists/*
# Copy necessary files
COPY package.json bun.lockb ./
# Install production dependencies
RUN /root/.bun/bin/bun install --production
# Start a new build stage from a distroless base image
FROM gcr.io/distroless/base
# Set the working directory
WORKDIR /app
# Copy files from the builder stage
COPY --from=builder /root/.bun/bin/bun bun
COPY --from=builder /app/node_modules node_modules
COPY --from=builder /usr/share/dict/words /usr/share/dict/words
COPY src src
COPY tsconfig.json .
# Set environment variable
ENV NODE_ENV production
# Set the command to run your application
CMD ["./bun", "src/index.ts"]