Skip to content

Commit b443929

Browse files
committed
Updated docker to use nginx as a reverse proxy
1 parent 5f0ba82 commit b443929

4 files changed

Lines changed: 113 additions & 20 deletions

File tree

.github/workflows/dev.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
name: Build and Push Docker Image to GHCR
1+
name: Build and Push Docker Dev Image to GHCR
22

33
# Trigger the action when pushing to the main branch
44
on:
55
push:
66
branches:
77
- dev
8-
- main
98

109
jobs:
1110
build:
@@ -30,13 +29,13 @@ jobs:
3029
# Build and push Docker image to Docker Hub
3130
- name: Build and Push Docker image (Docker Hub)
3231
run: |
33-
docker build -t rohanbatra/second_brain_database:latest .
34-
docker push rohanbatra/second_brain_database:latest
32+
docker build -t rohanbatra/second_brain_database:dev .
33+
docker push rohanbatra/second_brain_database:dev
3534
3635
- name: Publish to Github Registry
3736
uses: elgohr/Publish-Docker-Github-Action@v5
3837
with:
3938
name: rohanbatrain/second_brain_database/dev
4039
username: ${{ github.actor }}
4140
password: ${{ secrets.GITHUB_TOKEN }}
42-
registry: ghcr.io
41+
registry: ghcr.io

.github/workflows/main.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Push Docker Latest Image to GHCR
2+
3+
# Trigger the action when pushing to the main branch
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Checkout the code from the repository
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
# Set up Docker Buildx (needed for building Docker images in GitHub Actions)
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v2
21+
22+
# Login to Docker Hub before building and pushing (good practice)
23+
- name: Login to Docker Hub
24+
uses: docker/login-action@v2
25+
with:
26+
username: rohanbatra
27+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
28+
29+
# Build and push Docker image to Docker Hub
30+
- name: Build and Push Docker image (Docker Hub)
31+
run: |
32+
docker build -t rohanbatra/second_brain_database:latest .
33+
docker push rohanbatra/second_brain_database:latest
34+
35+
- name: Publish to Github Registry
36+
uses: elgohr/Publish-Docker-Github-Action@v5
37+
with:
38+
name: rohanbatrain/second_brain_database
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
registry: ghcr.io

dev-environment/docker-compose.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,52 @@
1+
version: "3.8"
2+
13
services:
24
mongo:
35
image: mongo:latest
46
container_name: mongo
57
environment:
68
- MONGO_INITDB_DATABASE=${MONGO_DB_NAME}
7-
ports:
8-
- "27017:27017"
9+
networks:
10+
- proxy
11+
- default
912

1013
redis:
1114
image: redis:latest
1215
container_name: redis
13-
ports:
14-
- "6379:6379"
16+
networks:
17+
- proxy
18+
- default
1519

1620
second_brain_database:
17-
image: rohanbatra/second_brain_database:dev # or use build: . if needed
21+
image: rohanbatra/second_brain_database:dev
1822
container_name: second_brain_database
19-
ports:
20-
- "5000:5000"
2123
volumes:
2224
- ../../.sbd_config.json:/sbd_user/.config/Second-Brain-Database/.sbd_config.json:ro
2325
depends_on:
2426
- mongo
2527
- redis
28+
networks:
29+
- proxy
30+
- default
31+
32+
nginx_proxy_manager:
33+
image: jc21/nginx-proxy-manager:latest
34+
container_name: nginx_proxy_manager
35+
restart: unless-stopped
36+
ports:
37+
- "80:80" # HTTP
38+
- "443:443" # HTTPS
39+
- "81:81" # Admin UI
40+
volumes:
41+
- npm_data:/data
42+
- npm_letsencrypt:/etc/letsencrypt
43+
networks:
44+
- proxy
45+
46+
networks:
47+
proxy:
48+
driver: bridge
2649

50+
volumes:
51+
npm_data:
52+
npm_letsencrypt:

docker-compose.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
1+
version: "3.8"
2+
13
services:
24
mongo:
35
image: mongo:latest
46
container_name: mongo
57
environment:
68
- MONGO_INITDB_DATABASE=${MONGO_DB_NAME}
7-
ports:
8-
- "27017:27017"
9+
networks:
10+
- proxy
11+
- default
912

1013
redis:
1114
image: redis:latest
1215
container_name: redis
13-
ports:
14-
- "6379:6379"
16+
networks:
17+
- proxy
18+
- default
1519

1620
second_brain_database:
17-
image: rohanbatra/second_brain_database:latest # or use build: . if needed
21+
image: rohanbatra/second_brain_database:latest
1822
container_name: second_brain_database
19-
ports:
20-
- "5000:5000"
2123
volumes:
2224
- ./.sbd_config.json:/sbd_user/.config/Second-Brain-Database/.sbd_config.json:ro
2325
depends_on:
2426
- mongo
25-
- redis
27+
- redis
28+
networks:
29+
- proxy
30+
- default
31+
32+
nginx_proxy_manager:
33+
image: jc21/nginx-proxy-manager:latest
34+
container_name: nginx_proxy_manager
35+
restart: unless-stopped
36+
ports:
37+
- "80:80"
38+
- "443:443"
39+
- "81:81"
40+
volumes:
41+
- npm_data:/data
42+
- npm_letsencrypt:/etc/letsencrypt
43+
networks:
44+
- proxy
45+
46+
networks:
47+
proxy:
48+
driver: bridge
49+
50+
volumes:
51+
npm_data:
52+
npm_letsencrypt:

0 commit comments

Comments
 (0)