-
Notifications
You must be signed in to change notification settings - Fork 233
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 1008 Bytes
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 1008 Bytes
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
# Step 1: Build the application
FROM oven/bun AS builder
# Set the working directory in the container
WORKDIR /app
# Copy all the application files to the container
COPY . .
# Run your build process
RUN bun i
RUN bun run --bun build
# Step 2: Create a smaller image for running the application
FROM oven/bun
# Install sqlite3 for database operations
RUN apt-get update && apt-get install -y sqlite3 && rm -rf /var/lib/apt/lists/*
# Set working directory for the second stage
WORKDIR /app
# Copy package.json and built files
COPY --from=builder /app/package.json .
COPY --from=builder /app/build ./build
# Copy migration files that are needed at runtime
COPY --from=builder /app/src/lib/server/db/migrations ./src/lib/server/db/migrations
# Copy scripts folder for database operations
COPY --from=builder /app/scripts ./scripts
# Install production dependencies only
RUN bun install --production
# Expose the port the application will run on
EXPOSE 3000
# Define start command
CMD ["bun", "./build"]