-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #559 from sparcs-kaist/558-update-dockerfile-for-t…
…ypescript #558 [Bug] Dockerfile이 올바르지 않음
- Loading branch information
Showing
1 changed file
with
31 additions
and
7 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,21 +1,45 @@ | ||
FROM node:18-alpine | ||
# | ||
# First stage: build the app | ||
# | ||
FROM node:18-alpine AS builder | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Install curl(for taxi-watchtower) and pnpm | ||
RUN apk update && apk add curl && npm install --global [email protected] | ||
# Install pnpm | ||
RUN npm install --global [email protected] | ||
|
||
# pnpm fetch does require only lockfile | ||
COPY pnpm-lock.yaml . | ||
RUN pnpm fetch | ||
|
||
COPY . . | ||
RUN pnpm install --offline | ||
RUN pnpm build | ||
|
||
# | ||
# Second stage: run the app | ||
# | ||
FROM node:18-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Install pnpm | ||
RUN npm install --global [email protected] | ||
|
||
# Install curl for taxi-watchtower | ||
RUN apk update && apk add curl | ||
|
||
# Note: devDependencies are not fetched | ||
# devDependencies are not fetched | ||
COPY pnpm-lock.yaml . | ||
RUN pnpm fetch --prod | ||
|
||
# Copy repository and install dependencies | ||
ADD . ./ | ||
COPY package.json . | ||
RUN pnpm install --offline --prod | ||
|
||
# Copy the built app from the previous stage | ||
COPY --from=builder /usr/src/app/dist ./dist | ||
|
||
# Run container | ||
EXPOSE 80 | ||
ENV PORT 80 | ||
CMD ["pnpm", "run", "serve"] | ||
CMD ["pnpm", "serve"] |