From 2c643e679d1a816933924b2ad2906e1816d9562f Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Tue, 26 Aug 2025 15:02:29 -0400 Subject: [PATCH] fixes with CRLF, .gitpod.yml updated --- .gitpod.yml | 74 +++++++++++++++++++++-------- backend/Dockerfile | 6 ++- backend/README.md | 4 +- deployment/local/.env-gitpod | 12 +++++ deployment/local/docker-compose.yml | 7 +-- frontend/.prettierrc | 3 +- 6 files changed, 75 insertions(+), 31 deletions(-) create mode 100644 deployment/local/.env-gitpod diff --git a/.gitpod.yml b/.gitpod.yml index 63b4f04..275ceba 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,27 +1,61 @@ -# Use a custom Docker image -image: - file: .gitpod.Dockerfile +image: gitpod/workspace-full:latest -# Tasks to run when workspace starts tasks: - - name: Install & Start Vue + - name: infrastructure + before: | + echo 'Bringing down any previously running containers' init: | - cd frontend - npm install + cd deployment/local + docker-compose down -v + - name: postgres + init: | + cd deployment/local + echo 'Starting postgres container' + docker-compose up -d postgres + echo 'Started postgres' + - name: backend + init: | + cd deployment/local + echo 'Building backend container' + docker-compose build backend + echo 'Built backend' command: | - cd frontend - npm run dev - + gp await-port 7432 + cd deployment/local + echo 'Starting backend container' + docker-compose up -d backend + echo 'Started backend' + - name: frontend + init: | + cd deployment/local + echo 'Copying .env-gitpod to .env' + cp .env-gitpod .env + eval $(gp env -e) + export VITE_API_BASE_URL=$(gp url 8300) + echo 'Building frontend container' + docker-compose build frontend + echo 'Built frontend' + command: | + gp await-port 8300 + eval $(gp env -e) + export VITE_API_BASE_URL=$(gp url 8300) + cd deployment/local + echo 'Starting frontend container' + docker-compose up -d frontend + echo 'Started frontend' -# Ports to expose ports: - - port: 5173 + - name: Frontend + description: Port 4000 for the frontend + port: 4000 onOpen: open-preview - -# VS Code extensions for Vue 3 + Vite -vscode: - extensions: - - octref.vetur # Vue tooling - - Vue.volar # Vue 3 IntelliSense - - esbenp.prettier-vscode - - dbaeumer.vscode-eslint + visibility: public + - name: Backend + description: Port 8300 for the backend + port: 8300 + onOpen: ignore + visibility: public + - name: postgres + description: Port 7432 for the postgres + port: 7432 + onOpen: ignore \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile index e3cdabc..51d5149 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -18,6 +18,7 @@ RUN apt-get update \ curl \ libpq-dev \ postgresql-client \ + dos2unix \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching @@ -30,8 +31,9 @@ RUN pip install --no-cache-dir --upgrade pip \ # Copy application code COPY . . -# Make entrypoint script executable -RUN chmod +x docker-entrypoint.sh +# Convert entrypoint script to LF and make it executable +RUN dos2unix /app/docker-entrypoint.sh \ + && chmod +x /app/docker-entrypoint.sh # Create non-root user for security RUN adduser --disabled-password --gecos '' appuser \ diff --git a/backend/README.md b/backend/README.md index 977a5cd..e9289c2 100644 --- a/backend/README.md +++ b/backend/README.md @@ -19,7 +19,7 @@ A modern FastAPI boilerplate with proper separation of concerns, PostgreSQL inte ## 📁 **Project Structure** ``` -python-fastapi/ +backend/ ├── app/ │ ├── __init__.py │ ├── database.py # Database configuration @@ -65,7 +65,7 @@ python-fastapi/ 1. **Clone the repository** ```bash git clone - cd python-fastapi + cd backend ``` 2. **Run with Docker Compose** diff --git a/deployment/local/.env-gitpod b/deployment/local/.env-gitpod new file mode 100644 index 0000000..ba698ec --- /dev/null +++ b/deployment/local/.env-gitpod @@ -0,0 +1,12 @@ +# Deployment environment +NODE_ENV=production + +# Ports +FRONTEND_HTTP_PORT=4000 + + +# Frontend API base +VITE_API_BASE_URL=http://localhost:3000 + +# Backend DATABASE_URL +DATABASE_URL=postgresql://fastapi_user:fastapi_password@postgres:5432/fastapi_db \ No newline at end of file diff --git a/deployment/local/docker-compose.yml b/deployment/local/docker-compose.yml index 60a85d4..6563e9b 100644 --- a/deployment/local/docker-compose.yml +++ b/deployment/local/docker-compose.yml @@ -13,7 +13,7 @@ services: environment: - VITE_API_BASE_URL=${VITE_API_BASE_URL:-http://localhost:3000} ports: - - "${FRONTEND_HTTP_PORT:-8080}:80" + - "${FRONTEND_HTTP_PORT:-4000}:80" restart: unless-stopped backend: build: @@ -28,9 +28,6 @@ services: - DATABASE_URL=${DATABASE_URL:-postgresql://fastapi_user:fastapi_password@postgres:5432/fastapi_db} ports: - "8300:8000" - volumes: - - .:/app - - /app/__pycache__ restart: unless-stopped depends_on: postgres: @@ -52,8 +49,6 @@ services: POSTGRES_INITDB_ARGS: "--encoding=UTF-8" ports: - "7432:5432" - volumes: - - postgres_data:/var/lib/postgresql/data restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U fastapi_user -d fastapi_db"] diff --git a/frontend/.prettierrc b/frontend/.prettierrc index f9fdc87..fe5976e 100644 --- a/frontend/.prettierrc +++ b/frontend/.prettierrc @@ -2,5 +2,6 @@ "semi": true, "singleQuote": true, "printWidth": 100, - "trailingComma": "all" + "trailingComma": "all", + "endOfLine": "auto" }