diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ce2c29a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +./latosa-frontend/node_modules/ diff --git a/Dockerfile b/Dockerfile index f32490b..cd099dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,13 +7,21 @@ WORKDIR /app # Copy project files COPY ./latosa-frontend/ . +ENV NODE_ENV=production RUN deno install # Install Next.js dependencies 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 3000 # Start the Next.js app -CMD ["deno", "task", "start"] +CMD ["deno", "run", "--allow-env", "--allow-read", "--allow-sys", "--allow-net", ".next/standalone/server.cjs"] diff --git a/latosa-frontend/next.config.ts b/latosa-frontend/next.config.ts index 7921f35..4119f6e 100644 --- a/latosa-frontend/next.config.ts +++ b/latosa-frontend/next.config.ts @@ -2,6 +2,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { /* config options here */ + output: "standalone", }; export default nextConfig;