From 6336a83eb35e50cf754e144c961034a0cb1788f4 Mon Sep 17 00:00:00 2001 From: Nattapong Anansomsin Date: Wed, 23 Oct 2024 11:41:29 +0700 Subject: [PATCH] feat: add docker file --- .dockerignore | 5 +++++ Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bc87175 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +npm-debug.log +Dockerfile +.dockerignore +proto/generatedTypes/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d03f98 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Stage 1: Build the application +FROM node:20.11.0-alpine AS build + +WORKDIR /app + +COPY package*.json ./ +RUN npm install + +COPY . . +RUN npm run proto:gen +RUN npx prisma generate + +# Stage 2: Run the application +FROM node:20.11.0-alpine AS prod + +WORKDIR /app + +COPY --from=build /app /app + +EXPOSE 8082 + +CMD ["npm", "run", "dev"]