-
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
1 changed file
with
24 additions
and
23 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,35 +1,36 @@ | ||
# Build BASE | ||
FROM node:18-alpine as BASE | ||
FROM node:18-alpine AS deps | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock ./ | ||
RUN yarn install | ||
RUN yarn --frozen-lockfile | ||
|
||
# Build Image | ||
FROM node:18-alpine AS BUILD | ||
WORKDIR /app | ||
# FROM node:18-alpine AS builder | ||
# WORKDIR /app | ||
# COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
RUN apk add --no-cache curl | ||
RUN curl -sf https://gobinaries.com/tj/node-prune | sh -s -- -b /usr/local/bin | ||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
COPY --from=BASE /app/node_modules ./node_modules | ||
COPY . . | ||
RUN yarn build | ||
RUN cd .next/standalone | ||
RUN node-prune | ||
|
||
# Build production | ||
FROM node:18-alpine AS PRODUCTION | ||
ENV NODE_ENV production | ||
WORKDIR /app | ||
# FROM node:18-alpine AS runner | ||
# WORKDIR /app | ||
|
||
# COPY --from=BUILD /app/.env.example ./.env | ||
COPY --from=BUILD /app/public ./public | ||
COPY --from=BUILD /app/next.config.js ./ | ||
COPY --from=BUILD /app/.next/standalone ./ | ||
COPY --from=BUILD /app/.next/static ./.next/static | ||
# ENV NODE_ENV production | ||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN mkdir -p /app/public/social-images/ | ||
# RUN addgroup --system --gid 1001 nodejs | ||
# RUN adduser --system --uid 1001 nextjs | ||
|
||
# COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next | ||
# COPY --from=builder /app/node_modules ./node_modules | ||
# COPY --from=builder /app/package.json ./package.json | ||
|
||
# USER nextjs | ||
|
||
EXPOSE 3000 | ||
CMD ["node", "server.js"] | ||
|
||
ENV PORT 3000 | ||
|
||
CMD ["yarn", "start"] |