@@ -14,15 +14,6 @@ COPY package.json bun.lockb ./
14
14
RUN bun install
15
15
16
16
17
- # Runtime dependencies are installed in a separate stage so that development
18
- # dependencies are not included in the final image. This reduces the size of the
19
- # final image.
20
- FROM base AS runtime-deps
21
- WORKDIR /app
22
- COPY package.json bun.lockb ./
23
- RUN bun install --production
24
-
25
-
26
17
# This is the final stage of the build process. It copies the application code
27
18
# and builds the application.
28
19
FROM base AS builder
@@ -38,14 +29,15 @@ RUN bun build index.ts --outfile dist/index.js
38
29
# the application code and the runtime dependencies from the previous stages.
39
30
FROM oven/bun:${VERSION}-alpine AS runtime
40
31
WORKDIR /app
32
+ # Install ca-certificates to allow the application to make HTTPS requests
33
+ RUN apk --update --no-cache add ca-certificates \
34
+ && update-ca-certificates 2>/dev/null || true
41
35
# Install wget to allow health checks on the container. Then clean up the apt cache to reduce the image size.
42
36
# e.g. `wget -nv -t1 --spider 'http://localhost:8080/health' || exit 1`
43
37
RUN apk add --no-cache wget && rm -rf /var/cache/apk/*
44
38
RUN addgroup --system nonroot && adduser --system --ingroup nonroot nonroot
45
39
RUN chown -R nonroot:nonroot /app
46
40
47
- # Copy the runtime dependencies from the runtime-deps stage
48
- COPY --chown=nonroot:nonroot --from=runtime-deps /app/node_modules ./node_modules
49
41
# Copy the application from the build stage to the final stage.
50
42
# You should change "dist" to the directory where your build output is located.
51
43
COPY --chown=nonroot:nonroot --from=builder /app/dist ./dist
0 commit comments