diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..aa3a93b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e97a6e7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +ARG NODE_ENV=production +ARG NODE_VERSION=22 + +# Base image +FROM node:${NODE_VERSION} + +# Create app directory +WORKDIR /usr/src/app + +# A wildcard is used to ensure both package.json AND package-lock.json are copied +COPY package*.json ./ + +# Install app dependencies +RUN npm ci --ignore-scripts + +# Bundle app source +COPY . . + +# Prisma +RUN npx prisma generate + +# Creates a "dist" folder with the production build +RUN npm run build + +EXPOSE 3000 + +# Start the server using the production build +CMD [ "node", "dist/main.js" ] diff --git a/captain-definition b/captain-definition index d920716..0e14f82 100644 --- a/captain-definition +++ b/captain-definition @@ -1,4 +1,4 @@ { "schemaVersion": 2, - "templateId": "node/22.8" + "dockerfilePath": "./Dockerfile" }