-
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.
refactor: overhaul Dockerfile and docker-compose.yml
- Loading branch information
Showing
2 changed files
with
16 additions
and
10 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,31 @@ | ||
FROM node:20.1.0-alpine AS base | ||
|
||
ARG ENV | ||
WORKDIR /app | ||
|
||
RUN npm install -g pnpm | ||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
WORKDIR /app | ||
RUN npm install -g [email protected] | ||
|
||
FROM base AS deps | ||
|
||
COPY package.json pnpm-lock.yaml ./ | ||
|
||
RUN pnpm install --frozen-lockfile --prod | ||
|
||
FROM base AS builder | ||
|
||
COPY . . | ||
COPY --from=deps /app/node_modules ./node_modules | ||
|
||
RUN pnpm ts:check && pnpm build | ||
|
||
ENV NODE_ENV production | ||
FROM base AS app | ||
|
||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
COPY --from=builder /app/.next ./.next | ||
COPY --from=builder /app/node_modules ./node_modules | ||
COPY --from=builder /app/public ./public | ||
COPY --from=builder /app/.env ./.env | ||
COPY --from=builder /app/package.json ./package.json | ||
|
||
CMD ["pnpm", "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