From 8a9eef554278bf7bc852f959f7cfe66b7f25bc6d Mon Sep 17 00:00:00 2001 From: rotten91 Date: Thu, 3 Oct 2024 19:35:53 +0200 Subject: [PATCH 1/2] feat(api): add dockerfile --- api/Dockerfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 api/Dockerfile diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 00000000..568c7897 --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.9 + +WORKDIR /code + +COPY ./requirements.txt /code/requirements.txt + +RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt +RUN pip install fastapi uvicorn + +COPY . /code + +# CMD ["fastapi", "run", "main.py", "--port", "80"] +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"] + +# If running behind a proxy like Nginx or Traefik add --proxy-headers +# CMD ["fastapi", "run", "app/main.py", "--port", "80", "--proxy-headers"] \ No newline at end of file From a53186f9cd49a18bf056f6ea9ba5af1a58d01ae2 Mon Sep 17 00:00:00 2001 From: rotten91 Date: Thu, 3 Oct 2024 21:38:12 +0200 Subject: [PATCH 2/2] feat(frontend): add optimized dockerfile --- front-end-nextjs/Dockerfile | 21 +++++++++++++++++++++ front-end-nextjs/next.config.js | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 front-end-nextjs/Dockerfile diff --git a/front-end-nextjs/Dockerfile b/front-end-nextjs/Dockerfile new file mode 100644 index 00000000..5e5e3b8f --- /dev/null +++ b/front-end-nextjs/Dockerfile @@ -0,0 +1,21 @@ +FROM node:18-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + + +FROM node:18-alpine AS runner +WORKDIR /app + +COPY --from=builder /app/.next/standalone ./standalone + +EXPOSE 3000 + +CMD ["node", "./standalone/server.js"] \ No newline at end of file diff --git a/front-end-nextjs/next.config.js b/front-end-nextjs/next.config.js index 767719fc..445e35fd 100644 --- a/front-end-nextjs/next.config.js +++ b/front-end-nextjs/next.config.js @@ -1,4 +1,6 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {} +const nextConfig = { + output: 'standalone' +} module.exports = nextConfig