Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker compose #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/docker-build-push.yaml
Original file line number Diff line number Diff line change
@@ -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 -f api/Dockerfile .

- name: Push Docker image
run: |
docker push mohamedsamir7744/challenge-api:latest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
# /.fleet
# /.idea
# /.vscode
# certs
# certs
.history
1 change: 1 addition & 0 deletions .history/client/.env_20241001205802
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL=http://api:8000
1 change: 1 addition & 0 deletions .history/client/.env_20241001230218
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL=http://api:9000
Empty file.
18 changes: 18 additions & 0 deletions .history/docker-compose_20241001214107.yaml
Original file line number Diff line number Diff line change
@@ -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"
53 changes: 53 additions & 0 deletions .history/docker-compose_20241001221238.yaml
Original file line number Diff line number Diff line change
@@ -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:
53 changes: 53 additions & 0 deletions .history/docker-compose_20241001221252.yaml
Original file line number Diff line number Diff line change
@@ -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:
53 changes: 53 additions & 0 deletions .history/docker-compose_20241001223641.yaml
Original file line number Diff line number Diff line change
@@ -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:
53 changes: 53 additions & 0 deletions .history/docker-compose_20241001223728.yaml
Original file line number Diff line number Diff line change
@@ -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:
53 changes: 53 additions & 0 deletions .history/docker-compose_20241001224108.yaml
Original file line number Diff line number Diff line change
@@ -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:
53 changes: 53 additions & 0 deletions .history/docker-compose_20241001224431.yaml
Original file line number Diff line number Diff line change
@@ -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:
Loading