From 7c90627601e4449a0378f515bb9fb2ae16381bbf Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Mon, 28 Oct 2024 00:14:26 -0400 Subject: [PATCH] Add Dockerfile --- .dockerignore | 14 ++++++++++++++ Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f6d0034 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +node_modules +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode +.resources +.env +.editorconfig +.idea +coverage* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5d3432c --- /dev/null +++ b/Dockerfile @@ -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" ]