build(app): optimize app docker image size
export app static pages and deploy with Nginx image, instead of host `next start` service
This commit is contained in:
parent
655fbec583
commit
2f90e3f1a2
3 changed files with 6 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
FROM node:alpine
|
FROM node:alpine as builder
|
||||||
|
|
||||||
ARG NEXT_PUBLIC_WS_URL
|
ARG NEXT_PUBLIC_WS_URL
|
||||||
ARG NEXT_PUBLIC_API_URL
|
ARG NEXT_PUBLIC_API_URL
|
||||||
|
|
@ -12,4 +12,6 @@ COPY ui /home/perplexica/
|
||||||
RUN yarn install
|
RUN yarn install
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
CMD ["yarn", "start"]
|
FROM nginx:stable-alpine-slim
|
||||||
|
|
||||||
|
COPY --from=builder /home/perplexica/out /usr/share/nginx/html
|
||||||
|
|
@ -31,7 +31,7 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- perplexica-backend
|
- perplexica-backend
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:80
|
||||||
networks:
|
networks:
|
||||||
- perplexica-network
|
- perplexica-network
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
|
output: 'export',
|
||||||
images: {
|
images: {
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue