diff --git a/Dockerfile b/Dockerfile index 9b2e00e..9699a8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,37 @@ -# Use official node image as the base image -FROM node:16 +# First stage: Build +FROM node:16-alpine AS build -# Set /usr/src/app as the working directory WORKDIR /usr/src/app -# Copy package.json and package-lock.json to the working directory -COPY package*.json ./ +# Install Yarn +RUN apk add --no-cache yarn + +# Copy package.json and yarn.lock to the working directory +COPY package.json yarn.lock ./ # Install dependencies -RUN npm install +RUN yarn install # Copy the rest of your app's source code to the working directory COPY . . # TypeScript -RUN npm install typescript -g +RUN yarn global add typescript RUN tsc +# Second stage: Run +FROM node:16-alpine + +WORKDIR /usr/src/app + +# Install Yarn +RUN apk add --no-cache yarn + +# Copy from build stage +COPY --from=build /usr/src/app . + # Expose the port the app runs on EXPOSE 3000 # Start the application -CMD [ "node", "dist/index.js" ] +CMD [ "yarn", "start" ] \ No newline at end of file diff --git a/package.json b/package.json index 2ae8708..84b055c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "doctolib-appointment-finder", - "version": "1.0.2", + "version": "1.0.3", "dependencies": { "@types/node": "^20.2.5", "@types/node-cron": "^3.0.7",