-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (48 loc) · 1.7 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM imbios/bun-node:22-slim AS deps
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
# Build the app
FROM deps AS builder
WORKDIR /app
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
RUN SKIP_ENV_VALIDATION=true bun run build
# Move node_modules to temp location to avoid overwriting
RUN mv node_modules _node_modules
RUN rm package.json bun.lockb
# Install dependencies for migration
RUN cp drizzle/migrate/package.json ./package.json
RUN cp drizzle/migrate/bun.lockb ./bun.lockb
RUN bun install --frozen-lockfile
# Copy node_modules for migration to migrate folder for migration script
RUN mv node_modules drizzle/migrate/node_modules
# Production image, copy all the files and run next
FROM imbios/bun-node:22-slim AS runner
WORKDIR /app
ARG CONFIG_FILE
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
# Install tzdata for timezone configuration
RUN apt-get update && apt-get install -y tzdata
# Set the timezone environment variable
ENV TZ=Australia/Adelaide
COPY --from=builder /app/scripts ./scripts
RUN chmod +x ./scripts/run.sh
# Copy drizle migration scripts
COPY --from=builder /app/drizzle/migrate ./migrate
COPY --from=builder /app/drizzle ./drizzle
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/docker/entrypoint .
RUN chmod +x entrypoint.sh
RUN chmod +x docker-entrypoint.d/*.sh
EXPOSE 3000/tcp
ENV PORT 3000
ENTRYPOINT [ "./entrypoint.sh", "scripts/run.sh" ]
CMD []