AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
build(frontend): Optimize Docker build time and image size (#8695)
Reinier van der Leer1f34f78e4e87
diff --git a/autogpt_platform/frontend/Dockerfile b/autogpt_platform/frontend/Dockerfileindex 7e55378367..2d92d69eaa 100644--- a/autogpt_platform/frontend/Dockerfile+++ b/autogpt_platform/frontend/Dockerfile@@ -2,7 +2,7 @@FROM node:21-alpine AS baseWORKDIR /appCOPY autogpt_platform/frontend/package.json autogpt_platform/frontend/yarn.lock ./-RUN yarn install --frozen-lockfile+RUN --mount=type=cache,target=/usr/local/share/.cache yarn install --frozen-lockfile# Dev stageFROM base AS dev@@ -16,17 +16,23 @@ FROM base AS buildCOPY autogpt_platform/frontend/ .RUN yarn build-# Prod stage+# Prod stage - based on NextJS reference Dockerfile https://github.com/vercel/next.js/blob/64271354533ed16da51be5dce85f0dbd15f17517/examples/with-docker/DockerfileFROM node:21-alpine AS prodENV NODE_ENV=productionWORKDIR /app-COPY --from=build /app/package.json /app/yarn.lock ./-RUN yarn install --frozen-lockfile+RUN addgroup --system --gid 1001 nodejs+RUN adduser --system --uid 1001 nextjs++RUN mkdir .next+RUN chown nextjs:nodejs .next++COPY --from=build --chown=nextjs:nodejs /app/.next/standalone ./+COPY --from=build --chown=nextjs:nodejs /app/.next/static ./.next/static-COPY --from=build /app/.next ./.nextCOPY --from=build /app/public ./public-COPY --from=build /app/next.config.mjs ./next.config.mjs++USER nextjsEXPOSE 3000-CMD ["yarn", "start"]+CMD ["node", "server.js"]diff --git a/autogpt_platform/frontend/next.config.mjs b/autogpt_platform/frontend/next.config.mjsindex 7dd19b5267..e96de25bca 100644--- a/autogpt_platform/frontend/next.config.mjs+++ b/autogpt_platform/frontend/next.config.mjs@@ -14,6 +14,7 @@ const nextConfig = {},];},+ output: "standalone",// TODO: Re-enable TypeScript checks once current issues are resolvedtypescript: {ignoreBuildErrors: true,