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

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"]