Reduced docker image size

This commit is contained in:
cdricms
2025-01-13 21:31:01 +01:00
parent 4161792f36
commit 09e2716e46
3 changed files with 11 additions and 1 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
./latosa-frontend/node_modules/

View File

@@ -7,13 +7,21 @@ WORKDIR /app
# Copy project files # Copy project files
COPY ./latosa-frontend/ . COPY ./latosa-frontend/ .
ENV NODE_ENV=production
RUN deno install RUN deno install
# Install Next.js dependencies # Install Next.js dependencies
RUN deno task build RUN deno task build
# Move everything to the standalone
RUN cp -r public .next/standalone/public
RUN cp -r .next/static .next/standalone/.next/static
RUN mv .next/standalone/server.js .next/standalone/server.cjs
RUN rm -r ./node_modules
# Expose the default Next.js port # Expose the default Next.js port
EXPOSE 3000 EXPOSE 3000
# Start the Next.js app # Start the Next.js app
CMD ["deno", "task", "start"] CMD ["deno", "run", "--allow-env", "--allow-read", "--allow-sys", "--allow-net", ".next/standalone/server.cjs"]

View File

@@ -2,6 +2,7 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
/* config options here */ /* config options here */
output: "standalone",
}; };
export default nextConfig; export default nextConfig;