Skip to content

Commit

Permalink
Add docker compose for alternative way to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
koraykural committed Nov 17, 2024
1 parent 7278b89 commit ba08db2
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
70 changes: 70 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: '3.8'

services:
api:
build:
context: .
dockerfile: api.Dockerfile
networks:
- app-network
depends_on:
- postgres
- redis
environment:
REDIS_HOST: redis
REDIS_PORT: 6379
DB_HOST: postgres
DB_PORT: 5432
DB_USERNAME: your_postgres_user
DB_PASSWORD: your_postgres_password
DB_DATABASE: your_postgres_db

desktop:
build:
context: .
dockerfile: desktop.Dockerfile
networks:
- app-network

mobile:
build:
context: .
dockerfile: mobile.Dockerfile
networks:
- app-network

nginx:
image: nginx:latest
ports:
- '80:80'
volumes:
- ./nginx-compose.conf:/etc/nginx/conf.d/default.conf
depends_on:
- api
- desktop
- mobile
networks:
- app-network

postgres:
image: postgres:13
environment:
POSTGRES_USER: your_postgres_user
POSTGRES_PASSWORD: your_postgres_password
POSTGRES_DB: your_postgres_db
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- app-network

redis:
image: redis:latest
networks:
- app-network

networks:
app-network:
driver: bridge

volumes:
postgres_data:
38 changes: 38 additions & 0 deletions nginx-compose.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
server {
listen 80;
server_name api.attendance.koraykural.com;

location / {
proxy_pass http://api:3333/;
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;
}
}

server {
listen 80;
server_name attendance.koraykural.com;

location / {
proxy_pass http://desktop:80/;
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;
}
}

server {
listen 80;
server_name mobile.attendance.koraykural.com;

location / {
proxy_pass http://mobile:80/;
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;
}
}

0 comments on commit ba08db2

Please sign in to comment.