Files
no-twitter-bot-stats/Dockerfile
Lucid 9557833df6
Some checks are pending
Main / build-and-push-docker-image (20.x) (push) Has started running
added build args and variables
2025-12-06 20:52:00 -05:00

45 lines
1.2 KiB
Docker

# --- Stage 1: Dependencies ---
FROM node:20-alpine AS dependencies
RUN corepack enable
RUN corepack prepare yarn@stable --activate
WORKDIR /app
COPY package.json yarn.lock .yarnrc.yml ./
RUN yarn install
# --- Stage 2: Builder ---
FROM node:20-alpine AS builder
RUN corepack enable
RUN corepack prepare yarn@stable --activate
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
RUN corepack enable
RUN corepack prepare yarn@stable --activate
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY . ./
RUN yarn prisma-gen
RUN yarn build
# --- Stage 3: Runner ---
FROM node:20-alpine AS runner
RUN corepack enable
RUN corepack prepare yarn@stable --activate
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
ARG NEXT_PUBLIC_GRAPHQL_URL
ENV NEXT_PUBLIC_GRAPHQL_URL=${NEXT_PUBLIC_GRAPHQL_URL}
ARG NEXT_PUBLIC_API_TOKEN
ENV NEXT_PUBLIC_API_TOKEN=${NEXT_PUBLIC_API_TOKEN}
RUN corepack enable
RUN corepack prepare yarn@stable --activate
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY --from=builder /app/src/prisma/generated ./src/prisma/generated
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/.yarn ./.yarn
COPY . ./
EXPOSE 3000
CMD ["yarn", "start"]