-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters