Skip to content

Commit

Permalink
chore: package lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormix committed Dec 5, 2023
1 parent 0179074 commit ac58df6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
55 changes: 22 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
FROM imbios/bun-node:18-debian AS deps
ARG DEBIAN_FRONTEND=noninteractive
FROM oven/bun AS builder

WORKDIR /tmp/app

COPY package.json .
COPY bun.lockb .

RUN bun install

COPY . .

COPY node_modules/.prisma ./node_modules/.prisma

RUN bun run build

FROM oven/bun AS runner

ARG THRESHOLD=${THRESHOLD}
ENV THRESHOLD=${THRESHOLD}
Expand All @@ -20,40 +34,15 @@ ENV DATABASE_URL=${DATABASE_URL}
ARG NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL}
ENV NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL}

RUN apt-get -y update && \
apt-get install -yq build-essential libpq-dev openssl libssl-dev git ca-certificates tzdata && \
ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

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 . .

RUN bun run build

FROM deps AS runner

WORKDIR /app

RUN rm -rf node_modules
COPY --from=builder /tmp/app/.next/standalone ./app/

COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/prisma ./prisma
RUN ls -la
COPY --from=builder /app/node_modules ./node_modules
RUN npx prisma generate
COPY --from=builder /tmp/app/package.json /app/package.json
COPY --from=builder /tmp/app/bun.lockb /app/bun.lockb

EXPOSE 3000
RUN bun install -p

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
ENV PORT 3000
COPY --from=builder /tmp/app/node_modules/.prisma /app/node_modules/.prisma

CMD ["node", "server.js"]
CMD ["bun", "start"]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"prebuild": "prisma generate",
"postinstall": "prisma generate",
"build": "bash ./build.sh",
"start": "next start",
"lint": "next lint",
Expand Down

0 comments on commit ac58df6

Please sign in to comment.