From cdfabe41dac8fb6b4207e2f2b902c3a0766f44e6 Mon Sep 17 00:00:00 2001 From: siwonpada Date: Fri, 8 Mar 2024 01:58:56 +0900 Subject: [PATCH] add docker file --- .dockerignore | 2 ++ Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5171c54 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3377160 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +#Step 1: Build the app in image 'builder' +FROM node:18-alpine AS builder + +WORKDIR /app + +COPY package.json package-lock.json ./ + +RUN apk update && \ + apk add build-base libheif vips-dev vips -q +RUN npm install --platform=linuxmusl + +COPY . . + +RUN npx prisma generate + +RUN npm run build + +#Step 2: Copy the build from 'builder' to 'runner' +FROM node:18-alpine + +WORKDIR /app + +ENV TZ=Asia/Seoul +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ + apk update && \ + apk add build-base libheif vips-dev vips -q + +COPY --from=builder /app ./ + +RUN npm install -D prisma --platform=linuxmusl + +EXPOSE 3000 + +CMD ["npm", "run", "start:deploy"]