Skip to content

Commit 5de8c75

Browse files
committed
feat: dockerised application
Signed-off-by: Ayush Sharma <[email protected]>
1 parent 594177e commit 5de8c75

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM golang:1.23 AS builder
2+
3+
WORKDIR /app
4+
5+
COPY go.mod go.sum ./
6+
RUN go mod download
7+
8+
COPY . .
9+
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
10+
11+
# Final image
12+
FROM debian:bookworm-slim
13+
WORKDIR /root/
14+
15+
COPY --from=builder /app/main .
16+
RUN chmod +x main
17+
18+
EXPOSE 8000
19+
CMD ["./main"]

docker-compose.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
services:
2+
backend:
3+
build: .
4+
ports:
5+
- "8000:8000"
6+
depends_on:
7+
- mongodb
8+
- redis
9+
environment:
10+
- MONGO_URI=mongodb://mongodb:27017/mydb
11+
- REDIS_URI=redis:6379
12+
- PORT=8000
13+
- MONGO_DB_NAME=event-trigger
14+
15+
mongodb:
16+
image: mongo:latest
17+
container_name: eventtrigger-db
18+
restart: always
19+
ports:
20+
- "27017:27017"
21+
22+
redis:
23+
image: redis:latest
24+
container_name: eventtrigger-redis
25+
restart: always
26+
ports:
27+
- "6379:6379"

0 commit comments

Comments
 (0)