2023-03-27 05:49:26 +00:00
|
|
|
FROM node:18-alpine AS base
|
|
|
|
|
|
|
|
FROM base AS deps
|
|
|
|
|
|
|
|
RUN apk add --no-cache libc6-compat
|
2023-03-26 08:56:05 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-03-30 17:41:43 +00:00
|
|
|
COPY package.json yarn.lock ./
|
2023-03-27 05:49:26 +00:00
|
|
|
|
2023-03-30 17:41:43 +00:00
|
|
|
RUN yarn install
|
2023-03-27 05:49:26 +00:00
|
|
|
|
|
|
|
FROM base AS builder
|
|
|
|
|
|
|
|
RUN apk update && apk add --no-cache git
|
|
|
|
|
2023-03-26 08:56:05 +00:00
|
|
|
ENV OPENAI_API_KEY=""
|
|
|
|
ENV CODE=""
|
2023-03-27 05:49:26 +00:00
|
|
|
ARG DOCKER=true
|
2023-03-26 08:56:05 +00:00
|
|
|
|
2023-03-27 05:49:26 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN yarn build
|
|
|
|
|
|
|
|
FROM base AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
ENV OPENAI_API_KEY=""
|
|
|
|
ENV CODE=""
|
2023-03-26 08:56:05 +00:00
|
|
|
|
2023-03-27 05:49:26 +00:00
|
|
|
COPY --from=builder /app/public ./public
|
|
|
|
COPY --from=builder /app/.next/standalone ./
|
|
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
|
|
COPY --from=builder /app/.next/server ./.next/server
|
2023-03-26 08:56:05 +00:00
|
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2023-03-27 05:49:26 +00:00
|
|
|
CMD ["node","server.js"]
|