From e03f00344757de16d9a9f782b0ef25356d8ccb8f Mon Sep 17 00:00:00 2001 From: xannaxks Date: Thu, 24 Jul 2025 15:59:46 +0600 Subject: [PATCH] feat: add Docker setup for frontend and compose configuration - Add Dockerfile for frontend containerization - Add docker-compose.yml for simplified development setup --- docker-compose.yml | 46 +++++++++++++++++++++++++++++++++++++++++++++ frontend/Dockerfile | 19 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 docker-compose.yml create mode 100644 frontend/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3fa01f9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,46 @@ +services: + db: + image: postgres:15 + restart: always + ports: + - "5432:5432" + environment: + - POSTGRES_DB=flashnotes + - POSTGRES_USER=flashnotes + - POSTGRES_PASSWORD=flashnotes + volumes: + - postgres_data:/var/lib/postgresql/data + + backend: + build: ./backend + ports: + - "8000:8000" + depends_on: + - db + environment: + - PROJECT_NAME=FlashNotes + - DOMAIN=localhost + - POSTGRES_SERVER=db + - POSTGRES_USER=flashnotes + - POSTGRES_PASSWORD=flashnotes + - POSTGRES_DB=flashnotes + - FIRST_SUPERUSER=admin@example.com + - FIRST_SUPERUSER_PASSWORD=admin123 + - USERS_OPEN_REGISTRATION=true + volumes: + - ./backend:/app + command: sh -c "./prestart.sh && uvicorn src.main:app --reload --host 0.0.0.0 --port 8000" + + frontend: + build: ./frontend + ports: + - "5173:5173" + depends_on: + - backend + volumes: + - ./frontend:/app + - /app/node_modules + command: pnpm run dev --host 0.0.0.0 + +volumes: + postgres_data: \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..d97c44a --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,19 @@ +FROM node:18-alpine + +WORKDIR /app + +# Install pnpm +RUN npm install -g pnpm + +# Copy package files +COPY package.json pnpm-lock.yaml ./ + +# Install dependencies +RUN pnpm install + +# Copy source code +COPY . . + +EXPOSE 5173 + +CMD ["pnpm", "run", "dev", "--host", "0.0.0.0"] \ No newline at end of file