diff --git a/Dockerfile b/Dockerfile index 2543d30..959ffec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file + +ENV PORT 3000 + +CMD ["yarn", "start"]