build(app): optimize app docker image by use Next.js standalone output
This commit is contained in:
parent
4f5f6be85f
commit
838b779f3d
2 changed files with 19 additions and 7 deletions
|
@ -1,9 +1,4 @@
|
|||
FROM node:alpine
|
||||
|
||||
ARG NEXT_PUBLIC_WS_URL
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
|
||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
FROM node:alpine as builder
|
||||
|
||||
WORKDIR /home/perplexica
|
||||
|
||||
|
@ -12,4 +7,20 @@ COPY ui /home/perplexica/
|
|||
RUN yarn install
|
||||
RUN yarn build
|
||||
|
||||
CMD ["yarn", "start"]
|
||||
FROM node:alpine as runner
|
||||
|
||||
ARG NEXT_PUBLIC_WS_URL
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
|
||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
|
||||
WORKDIR /home/perplexica
|
||||
|
||||
COPY --from=builder /home/perplexica/package.json .
|
||||
COPY --from=builder /home/perplexica/yarn.lock .
|
||||
COPY --from=builder /home/perplexica/next.config.mjs .
|
||||
COPY --from=builder /home/perplexica/.next/standalone .
|
||||
COPY --from=builder /home/perplexica/public ./public
|
||||
COPY --from=builder /home/perplexica/.next/static ./.next/static
|
||||
|
||||
ENTRYPOINT ["node", "server.js"]
|
|
@ -1,5 +1,6 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: 'standalone',
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue