Commit
•
e8b3124
1
Parent(s):
dfa7f55
use bun 🤓
Browse files- Dockerfile +5 -20
Dockerfile
CHANGED
@@ -1,23 +1,14 @@
|
|
1 |
# syntax=docker/dockerfile:1.4
|
2 |
|
3 |
-
|
4 |
-
# For more information, see https://nextjs.org/docs/pages/building-your-application/deploying#docker-image
|
5 |
-
|
6 |
-
FROM node:18 AS base
|
7 |
|
8 |
# Install dependencies only when needed
|
9 |
FROM base AS deps
|
10 |
WORKDIR /app
|
11 |
|
12 |
# Install dependencies based on the preferred package manager
|
13 |
-
COPY --link package.json
|
14 |
-
RUN
|
15 |
-
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
16 |
-
elif [ -f package-lock.json ]; then npm ci; \
|
17 |
-
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
18 |
-
else echo "Lockfile not found." && exit 1; \
|
19 |
-
fi
|
20 |
-
|
21 |
|
22 |
# Rebuild the source code only when needed
|
23 |
FROM base AS builder
|
@@ -26,20 +17,15 @@ COPY --from=deps --link /app/node_modules ./node_modules
|
|
26 |
COPY --link . .
|
27 |
|
28 |
# Next.js collects completely anonymous telemetry data about general usage.
|
29 |
-
# Learn more here: https://nextjs.org/telemetry
|
30 |
# Uncomment the following line in case you want to disable telemetry during the build.
|
31 |
# ENV NEXT_TELEMETRY_DISABLED 1
|
32 |
|
33 |
-
RUN
|
34 |
-
|
35 |
-
# If using yarn comment out above and use below instead
|
36 |
-
# RUN yarn build
|
37 |
|
38 |
# Production image, copy all the files and run next
|
39 |
FROM base AS runner
|
40 |
WORKDIR /app
|
41 |
|
42 |
-
|
43 |
ENV NODE_ENV production
|
44 |
# Uncomment the following line in case you want to disable telemetry during runtime.
|
45 |
# ENV NEXT_TELEMETRY_DISABLED 1
|
@@ -51,7 +37,6 @@ RUN \
|
|
51 |
COPY --from=builder --link /app/public ./public
|
52 |
|
53 |
# Automatically leverage output traces to reduce image size
|
54 |
-
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
55 |
COPY --from=builder --link --chown=1001:1001 /app/.next/standalone ./
|
56 |
COPY --from=builder --link --chown=1001:1001 /app/.next/static ./.next/static
|
57 |
|
@@ -62,4 +47,4 @@ EXPOSE 3000
|
|
62 |
ENV PORT 3000
|
63 |
ENV HOSTNAME 0.0.0.0
|
64 |
|
65 |
-
CMD ["
|
|
|
1 |
# syntax=docker/dockerfile:1.4
|
2 |
|
3 |
+
FROM oven/bun:1 AS base
|
|
|
|
|
|
|
4 |
|
5 |
# Install dependencies only when needed
|
6 |
FROM base AS deps
|
7 |
WORKDIR /app
|
8 |
|
9 |
# Install dependencies based on the preferred package manager
|
10 |
+
COPY --link package.json bun.lockb* ./
|
11 |
+
RUN bun install --frozen-lockfile
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Rebuild the source code only when needed
|
14 |
FROM base AS builder
|
|
|
17 |
COPY --link . .
|
18 |
|
19 |
# Next.js collects completely anonymous telemetry data about general usage.
|
|
|
20 |
# Uncomment the following line in case you want to disable telemetry during the build.
|
21 |
# ENV NEXT_TELEMETRY_DISABLED 1
|
22 |
|
23 |
+
RUN bun run build
|
|
|
|
|
|
|
24 |
|
25 |
# Production image, copy all the files and run next
|
26 |
FROM base AS runner
|
27 |
WORKDIR /app
|
28 |
|
|
|
29 |
ENV NODE_ENV production
|
30 |
# Uncomment the following line in case you want to disable telemetry during runtime.
|
31 |
# ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
37 |
COPY --from=builder --link /app/public ./public
|
38 |
|
39 |
# Automatically leverage output traces to reduce image size
|
|
|
40 |
COPY --from=builder --link --chown=1001:1001 /app/.next/standalone ./
|
41 |
COPY --from=builder --link --chown=1001:1001 /app/.next/static ./.next/static
|
42 |
|
|
|
47 |
ENV PORT 3000
|
48 |
ENV HOSTNAME 0.0.0.0
|
49 |
|
50 |
+
CMD ["bun", "run", "server.js"]
|