From 17e8af59e74def4b3dcb0bcd92f647a3cff778cd Mon Sep 17 00:00:00 2001 From: Mohamed SAMIR <100734578+MohamedSamir445@users.noreply.github.com> Date: Wed, 2 Oct 2024 18:14:20 +0300 Subject: [PATCH 1/4] task fin --- .history/client/.env_20241001205802 | 1 + .history/client/.env_20241001230218 | 1 + .history/docker-compose_20241001214059.yaml | 0 .history/docker-compose_20241001214107.yaml | 18 +++++++ .history/docker-compose_20241001221238.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001221252.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001223641.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001223728.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001224108.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001224431.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001224456.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001225113.yaml | 53 +++++++++++++++++++ .history/docker-compose_20241001230012.yaml | 53 +++++++++++++++++++ .history/nginx.conf/nginx_20241001224854.conf | 0 .history/nginx.conf/nginx_20241001224910.conf | 21 ++++++++ .history/nginx_20241001224908.conf | 21 ++++++++ .history/nginx_20241001234944.conf | 21 ++++++++ api/.history/Dockerfile_20241001213035 | 0 api/.history/Dockerfile_20241001213150 | 39 ++++++++++++++ api/Dockerfile | 39 ++++++++++++++ client/.env | 2 +- client/.history/Dockerfile_20241001213813 | 0 client/.history/Dockerfile_20241001213827 | 23 ++++++++ client/Dockerfile | 23 ++++++++ docker-compose.yaml | 53 +++++++++++++++++++ nginx.conf | 21 ++++++++ nginx.confd/nginx.conf | 21 ++++++++ 27 files changed, 780 insertions(+), 1 deletion(-) create mode 100644 .history/client/.env_20241001205802 create mode 100644 .history/client/.env_20241001230218 create mode 100644 .history/docker-compose_20241001214059.yaml create mode 100644 .history/docker-compose_20241001214107.yaml create mode 100644 .history/docker-compose_20241001221238.yaml create mode 100644 .history/docker-compose_20241001221252.yaml create mode 100644 .history/docker-compose_20241001223641.yaml create mode 100644 .history/docker-compose_20241001223728.yaml create mode 100644 .history/docker-compose_20241001224108.yaml create mode 100644 .history/docker-compose_20241001224431.yaml create mode 100644 .history/docker-compose_20241001224456.yaml create mode 100644 .history/docker-compose_20241001225113.yaml create mode 100644 .history/docker-compose_20241001230012.yaml create mode 100644 .history/nginx.conf/nginx_20241001224854.conf create mode 100644 .history/nginx.conf/nginx_20241001224910.conf create mode 100644 .history/nginx_20241001224908.conf create mode 100644 .history/nginx_20241001234944.conf create mode 100644 api/.history/Dockerfile_20241001213035 create mode 100644 api/.history/Dockerfile_20241001213150 create mode 100644 api/Dockerfile create mode 100644 client/.history/Dockerfile_20241001213813 create mode 100644 client/.history/Dockerfile_20241001213827 create mode 100644 client/Dockerfile create mode 100644 docker-compose.yaml create mode 100644 nginx.conf create mode 100644 nginx.confd/nginx.conf diff --git a/.history/client/.env_20241001205802 b/.history/client/.env_20241001205802 new file mode 100644 index 00000000..4edaf880 --- /dev/null +++ b/.history/client/.env_20241001205802 @@ -0,0 +1 @@ +VITE_API_URL=http://api:8000 diff --git a/.history/client/.env_20241001230218 b/.history/client/.env_20241001230218 new file mode 100644 index 00000000..f4f79223 --- /dev/null +++ b/.history/client/.env_20241001230218 @@ -0,0 +1 @@ +VITE_API_URL=http://api:9000 diff --git a/.history/docker-compose_20241001214059.yaml b/.history/docker-compose_20241001214059.yaml new file mode 100644 index 00000000..e69de29b diff --git a/.history/docker-compose_20241001214107.yaml b/.history/docker-compose_20241001214107.yaml new file mode 100644 index 00000000..f9d2ee3f --- /dev/null +++ b/.history/docker-compose_20241001214107.yaml @@ -0,0 +1,18 @@ +version: '3.8' + +services: + node-app: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - php-app + + php-app: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" \ No newline at end of file diff --git a/.history/docker-compose_20241001221238.yaml b/.history/docker-compose_20241001221238.yaml new file mode 100644 index 00000000..557de4dd --- /dev/null +++ b/.history/docker-compose_20241001221238.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3306:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001221252.yaml b/.history/docker-compose_20241001221252.yaml new file mode 100644 index 00000000..557de4dd --- /dev/null +++ b/.history/docker-compose_20241001221252.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3306:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001223641.yaml b/.history/docker-compose_20241001223641.yaml new file mode 100644 index 00000000..d156ba74 --- /dev/null +++ b/.history/docker-compose_20241001223641.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3307:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001223728.yaml b/.history/docker-compose_20241001223728.yaml new file mode 100644 index 00000000..557de4dd --- /dev/null +++ b/.history/docker-compose_20241001223728.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3306:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001224108.yaml b/.history/docker-compose_20241001224108.yaml new file mode 100644 index 00000000..ac7ad984 --- /dev/null +++ b/.history/docker-compose_20241001224108.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3307:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - /absolute/path/to/nginx.conf:/etc/nginx/nginx.conf # Replace with the actual absolute path + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001224431.yaml b/.history/docker-compose_20241001224431.yaml new file mode 100644 index 00000000..8e90654f --- /dev/null +++ b/.history/docker-compose_20241001224431.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3307:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - D:/University/4.2/Challenge/nginx.conf:/etc/nginx/nginx.conf # Use forward slashes + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001224456.yaml b/.history/docker-compose_20241001224456.yaml new file mode 100644 index 00000000..8e90654f --- /dev/null +++ b/.history/docker-compose_20241001224456.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3307:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - D:/University/4.2/Challenge/nginx.conf:/etc/nginx/nginx.conf # Use forward slashes + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001225113.yaml b/.history/docker-compose_20241001225113.yaml new file mode 100644 index 00000000..e1242865 --- /dev/null +++ b/.history/docker-compose_20241001225113.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3307:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - D:/University/4.2/Challenge/nginx.conf:/etc/nginx/nginx.conf # Use forward slashes + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/docker-compose_20241001230012.yaml b/.history/docker-compose_20241001230012.yaml new file mode 100644 index 00000000..f441cedd --- /dev/null +++ b/.history/docker-compose_20241001230012.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3307:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - D:/University/4.2/Challenge/nginx.conf:/etc/nginx/nginx.conf # Use forward slashes + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/.history/nginx.conf/nginx_20241001224854.conf b/.history/nginx.conf/nginx_20241001224854.conf new file mode 100644 index 00000000..e69de29b diff --git a/.history/nginx.conf/nginx_20241001224910.conf b/.history/nginx.conf/nginx_20241001224910.conf new file mode 100644 index 00000000..42e1a951 --- /dev/null +++ b/.history/nginx.conf/nginx_20241001224910.conf @@ -0,0 +1,21 @@ +http { + server { + listen 80; + + location / { + proxy_pass http://client:3000; # Forward requests to the Nuxt.js client + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /api { + proxy_pass http://api:9000; # Forward requests to the PHP API + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } + } \ No newline at end of file diff --git a/.history/nginx_20241001224908.conf b/.history/nginx_20241001224908.conf new file mode 100644 index 00000000..42e1a951 --- /dev/null +++ b/.history/nginx_20241001224908.conf @@ -0,0 +1,21 @@ +http { + server { + listen 80; + + location / { + proxy_pass http://client:3000; # Forward requests to the Nuxt.js client + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /api { + proxy_pass http://api:9000; # Forward requests to the PHP API + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } + } \ No newline at end of file diff --git a/.history/nginx_20241001234944.conf b/.history/nginx_20241001234944.conf new file mode 100644 index 00000000..42e1a951 --- /dev/null +++ b/.history/nginx_20241001234944.conf @@ -0,0 +1,21 @@ +http { + server { + listen 80; + + location / { + proxy_pass http://client:3000; # Forward requests to the Nuxt.js client + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /api { + proxy_pass http://api:9000; # Forward requests to the PHP API + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } + } \ No newline at end of file diff --git a/api/.history/Dockerfile_20241001213035 b/api/.history/Dockerfile_20241001213035 new file mode 100644 index 00000000..e69de29b diff --git a/api/.history/Dockerfile_20241001213150 b/api/.history/Dockerfile_20241001213150 new file mode 100644 index 00000000..7ca060fc --- /dev/null +++ b/api/.history/Dockerfile_20241001213150 @@ -0,0 +1,39 @@ +FROM php:8.2-fpm-alpine + +# Install system dependencies +RUN apk add --no-cache \ + libpng-dev \ + libjpeg-turbo-dev \ + libwebp-dev \ + libxpm-dev \ + libzip-dev \ + unzip \ + git \ + bash \ + curl \ + libxml2-dev \ + oniguruma-dev \ + postgresql-dev \ + libmcrypt-dev + +# Install PHP extensions +RUN docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-webp=/usr/include/ --with-xpm=/usr/include/ +RUN docker-php-ext-install gd zip pdo pdo_mysql pdo_pgsql mbstring xml + +# Set the working directory +WORKDIR /var/www + +# Copy the existing application directory contents +COPY . . + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Install PHP dependencies +RUN composer install --no-interaction --prefer-dist + +# Expose the port the app runs on +EXPOSE 9000 + +# Start the PHP FastCGI Process Manager +CMD ["php-fpm"] diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 00000000..7ca060fc --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,39 @@ +FROM php:8.2-fpm-alpine + +# Install system dependencies +RUN apk add --no-cache \ + libpng-dev \ + libjpeg-turbo-dev \ + libwebp-dev \ + libxpm-dev \ + libzip-dev \ + unzip \ + git \ + bash \ + curl \ + libxml2-dev \ + oniguruma-dev \ + postgresql-dev \ + libmcrypt-dev + +# Install PHP extensions +RUN docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-webp=/usr/include/ --with-xpm=/usr/include/ +RUN docker-php-ext-install gd zip pdo pdo_mysql pdo_pgsql mbstring xml + +# Set the working directory +WORKDIR /var/www + +# Copy the existing application directory contents +COPY . . + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Install PHP dependencies +RUN composer install --no-interaction --prefer-dist + +# Expose the port the app runs on +EXPOSE 9000 + +# Start the PHP FastCGI Process Manager +CMD ["php-fpm"] diff --git a/client/.env b/client/.env index 4edaf880..f4f79223 100644 --- a/client/.env +++ b/client/.env @@ -1 +1 @@ -VITE_API_URL=http://api:8000 +VITE_API_URL=http://api:9000 diff --git a/client/.history/Dockerfile_20241001213813 b/client/.history/Dockerfile_20241001213813 new file mode 100644 index 00000000..e69de29b diff --git a/client/.history/Dockerfile_20241001213827 b/client/.history/Dockerfile_20241001213827 new file mode 100644 index 00000000..a71646e6 --- /dev/null +++ b/client/.history/Dockerfile_20241001213827 @@ -0,0 +1,23 @@ +# Use the official Node.js image as a base +FROM node:16 + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (if available) +COPY package.json package-lock.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the Nuxt.js application +RUN npm run build + +# Expose the port the app runs on +EXPOSE 3000 + +# Command to run the application +CMD ["npm", "start"] diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 00000000..a71646e6 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,23 @@ +# Use the official Node.js image as a base +FROM node:16 + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (if available) +COPY package.json package-lock.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the Nuxt.js application +RUN npm run build + +# Expose the port the app runs on +EXPOSE 3000 + +# Command to run the application +CMD ["npm", "start"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..f441cedd --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,53 @@ +version: '3.8' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bookapi + MYSQL_USER: app + MYSQL_PASSWORD: password + ports: + - "3307:3306" + volumes: + - db_data:/var/lib/mysql + + api: + build: + context: ./api + dockerfile: Dockerfile + ports: + - "9000:9000" + depends_on: + - db + environment: + DB_CONNECTION: mysql + DB_HOST: db + DB_PORT: 3306 + DB_DATABASE: bookapi + DB_USERNAME: app + DB_PASSWORD: password + + client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "3000:3000" + depends_on: + - api + command: npm run dev + + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - D:/University/4.2/Challenge/nginx.conf:/etc/nginx/nginx.conf # Use forward slashes + depends_on: + - client + - api + +volumes: + db_data: \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..42e1a951 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +http { + server { + listen 80; + + location / { + proxy_pass http://client:3000; # Forward requests to the Nuxt.js client + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /api { + proxy_pass http://api:9000; # Forward requests to the PHP API + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } + } \ No newline at end of file diff --git a/nginx.confd/nginx.conf b/nginx.confd/nginx.conf new file mode 100644 index 00000000..42e1a951 --- /dev/null +++ b/nginx.confd/nginx.conf @@ -0,0 +1,21 @@ +http { + server { + listen 80; + + location / { + proxy_pass http://client:3000; # Forward requests to the Nuxt.js client + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /api { + proxy_pass http://api:9000; # Forward requests to the PHP API + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } + } \ No newline at end of file From 8f3f721a01880cecfcfb141a20c629eab282dbe2 Mon Sep 17 00:00:00 2001 From: Mohamed SAMIR <100734578+MohamedSamir445@users.noreply.github.com> Date: Wed, 2 Oct 2024 18:17:18 +0300 Subject: [PATCH 2/4] edit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4e7d6904..a141f31f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ # /.fleet # /.idea # /.vscode -# certs \ No newline at end of file +# certs +.history \ No newline at end of file From 23eb95cbfea3c5dc98c13399e068b6ad4db0b33b Mon Sep 17 00:00:00 2001 From: Mohamed SAMIR <100734578+MohamedSamir445@users.noreply.github.com> Date: Wed, 2 Oct 2024 18:55:16 +0300 Subject: [PATCH 3/4] github workflow --- .github/workflows/docker-build-push.yaml | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/docker-build-push.yaml diff --git a/.github/workflows/docker-build-push.yaml b/.github/workflows/docker-build-push.yaml new file mode 100644 index 00000000..3301a492 --- /dev/null +++ b/.github/workflows/docker-build-push.yaml @@ -0,0 +1,28 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main # Change this to your default branch if different + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build Docker image + run: | + docker build -t mohamedsamir7744/challenge-api:latest . + + - name: Push Docker image + run: | + docker push mohamedsamir7744/challenge-api:latest \ No newline at end of file From fc52c75a1028c15d4c591e52ffab09c6d4a3cd00 Mon Sep 17 00:00:00 2001 From: Mohamed SAMIR <100734578+MohamedSamir445@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:04:27 +0300 Subject: [PATCH 4/4] modify ci/cd --- .github/workflows/docker-build-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-push.yaml b/.github/workflows/docker-build-push.yaml index 3301a492..5b08f5bc 100644 --- a/.github/workflows/docker-build-push.yaml +++ b/.github/workflows/docker-build-push.yaml @@ -21,7 +21,7 @@ jobs: - name: Build Docker image run: | - docker build -t mohamedsamir7744/challenge-api:latest . + docker build -t mohamedsamir7744/challenge-api:latest -f api/Dockerfile . - name: Push Docker image run: |