Skip to content

Commit

Permalink
Merge pull request #559 from sparcs-kaist/558-update-dockerfile-for-t…
Browse files Browse the repository at this point in the history
…ypescript

#558 [Bug] Dockerfile이 올바르지 않음
  • Loading branch information
kmc7468 authored Nov 26, 2024
2 parents 51ac4f5 + a9e2f50 commit 13cc0d4
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions Dockerfile
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"]

0 comments on commit 13cc0d4

Please sign in to comment.