Skip to content

Commit

Permalink
Added Caddy Support to Talawa API Cloud Instance (PalisadoesFoundatio…
Browse files Browse the repository at this point in the history
…n#2430)

* feat: added caddy support

* refactor: fixed Dockerfile.dev versions

* docs: removed the nginx and certbot docs

* refactor: removed not used ports from docker compose

* fix: minor trailing spaces and comma

* fix: trailing spaces
  • Loading branch information
vasujain275 authored Aug 21, 2024
1 parent a683bda commit cd9c868
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 171 deletions.
5 changes: 5 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
api-demo.talawa.io {
reverse_proxy talawa-api-dev:4000 {
header_down Strict-Transport-Security max-age=31536000;
}
}
9 changes: 1 addition & 8 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Install Dependencies
FROM node:lts AS builder
FROM node:20.10.0 AS builder

WORKDIR /usr/src/app

Expand All @@ -9,13 +9,6 @@ RUN npm install

COPY . .

# Stage 2: Final image
FROM node:lts-bookworm-slim

WORKDIR /usr/src/app

COPY --from=builder /usr/src/app ./

EXPOSE 4000

CMD ["npm", "run", "dev"]
25 changes: 19 additions & 6 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"

services:
mongodb:
Expand All @@ -7,20 +7,18 @@ services:
- 27017:27017
volumes:
- mongodb-data:/data/db

redis-stack-server:
image: redis/redis-stack-server:latest
ports:
- 6379:6379
volumes:
- redis-data:/data/redis
- redis-data:/data/redis

talawa-api-dev-container:
talawa-api-dev:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "${SERVER_PORT:-4000}:${SERVER_PORT:-4000}"
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
Expand All @@ -32,6 +30,21 @@ services:
- REDIS_HOST=redis-stack-server
- REDIS_PORT=6379

caddy:
image: caddy/caddy:2.2.1-alpine
container_name: caddy-service
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- $PWD/Caddyfile:/etc/caddy/Caddyfile
- $PWD/site:/srv
- caddy_data:/data
- caddy_config:/config

volumes:
mongodb-data:
redis-data:
caddy_data:
caddy_config:
Loading

0 comments on commit cd9c868

Please sign in to comment.