1
0
Fork 0

wip: use bun (1.0) as runtime

This commit is contained in:
Vojtěch Mareš 2023-09-09 00:16:53 +02:00
parent 453e48c2b5
commit b0affaa936
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
6 changed files with 65 additions and 6573 deletions

View file

@ -9,10 +9,10 @@ stages:
lint next.js: lint next.js:
stage: lint stage: lint
image: node:18-alpine3.17 image: oven/bun:1.0.0
script: script:
- npm ci --frozen-lockfile - bun install --frozen-lockfile
- SKIP_ENV_VALIDATION=1 npm run lint - SKIP_ENV_VALIDATION=1 bun run lint
lint helm: lint helm:
stage: lint stage: lint

41
bun.alpine.dockerfile Normal file
View file

@ -0,0 +1,41 @@
FROM --platform=linux/amd64 alpine:3.18 as base
FROM --platform=linux/amd64 base as download
WORKDIR /tmp
RUN apk add --no-cache unzip
RUN wget https://github.com/oven-sh/bun/releases/download/bun-v1.0.0/bun-linux-x64.zip
RUN unzip bun-linux-x64.zip
FROM --platform=linux/amd64 base as bun
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-bin-2.35-r0.apk
RUN apk --no-cache --force-overwrite add glibc-2.35-r0.apk glibc-bin-2.35-r0.apk
RUN /usr/glibc-compat/bin/ldd /lib/ld-linux-x86-64.so.2
COPY --from=download /tmp/bun-linux-x64/bun /usr/local/bin
FROM --platform=linux/amd64 bun as app
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
EXPOSE 3000
ENV PORT 3000
ARG SKIP_ENV_VALIDATION=1
# RUN apk add --no-cache libc6-compat openssl1.1-compat # gcompat
COPY . .
RUN bun install --frozen-lockfile
RUN bunx prisma generate
RUN bun run build
CMD ["bun", "run", "/app/.next/standalone/server.js"]

19
bun.dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM --platform=linux/amd64 oven/bun:1.0.0
WORKDIR /app
EXPOSE 3000
ENV PORT 3000
ARG NEXT_TELEMETRY_DISABLED=1
ARG SKIP_ENV_VALIDATION=1
ENV NODE_ENV=production
RUN apt-get update && \
apt-get install -y ca-certificates openssl=1.1.1n-0+deb11u5
COPY . .
RUN bun install --frozen-lockfile
RUN bun --bun run build
CMD ["bun", "run", "/app/.next/standalone/server.js"]

BIN
bun.lockb Executable file

Binary file not shown.

6568
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@
"@heroicons/react": "^2.0.18", "@heroicons/react": "^2.0.18",
"@next-auth/prisma-adapter": "^1.0.5", "@next-auth/prisma-adapter": "^1.0.5",
"@paralleldrive/cuid2": "^2.2.1", "@paralleldrive/cuid2": "^2.2.1",
"@prisma/client": "^4.14.0", "@prisma/client": "^5.2.0",
"@t3-oss/env-nextjs": "^0.3.1", "@t3-oss/env-nextjs": "^0.3.1",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
@ -42,7 +42,7 @@
"postcss": "^8.4.21", "postcss": "^8.4.21",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.2.8", "prettier-plugin-tailwindcss": "^0.2.8",
"prisma": "^4.14.0", "prisma": "^5.2.0",
"tailwindcss": "^3.3.0", "tailwindcss": "^3.3.0",
"typescript": "^5.1.3" "typescript": "^5.1.3"
}, },