Add Dockerfile

This commit is contained in:
Hri7566 2024-10-28 00:14:26 -04:00
parent 9121d62065
commit 7c90627601
2 changed files with 37 additions and 0 deletions

14
.dockerignore Normal file
View File

@ -0,0 +1,14 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
.resources
.env
.editorconfig
.idea
coverage*

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
FROM base AS install
RUN mkdir -p /temp/prod
COPY package.json bun.lockb prisma /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
RUN bunx prisma generate
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY --from=install /temp/dev/prisma prisma
ENV NODE_ENV=production
RUN bun test
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/ .
USER bun
EXPOSE 8443/tcp
ENTRYPOINT [ "bun", "run", "src/start.ts" ]