Skip to content

Commit 87394bf

Browse files
committed
containerisation: add minimal docker conatiner support with compose
1 parent bf9eb77 commit 87394bf

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Build stage
2+
FROM golang:1.21-alpine AS builder
3+
4+
WORKDIR /app
5+
6+
# Copy go mod and sum files
7+
COPY go.mod go.sum ./
8+
9+
# Download dependencies
10+
RUN go mod download
11+
12+
# Copy the source code
13+
COPY . .
14+
15+
# Build the application
16+
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
17+
18+
# Final stage
19+
FROM alpine:latest
20+
21+
WORKDIR /app
22+
23+
# Copy the binary from builder
24+
COPY --from=builder /app/main .
25+
# Copy rclone config
26+
COPY rclone.conf .
27+
28+
# Run the application
29+
CMD ["./main"]

docker-compose.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3.8'
2+
3+
services:
4+
api:
5+
build: .
6+
ports:
7+
- "8080:8080"
8+
volumes:
9+
- ./rclone.conf:/app/rclone.conf:ro
10+
- /tmp:/tmp # For temporary file handling
11+
restart: unless-stopped
12+
environment:
13+
- TZ=Asia/Kolkata
14+
# Server configuration
15+
- SERVER_READ_TIMEOUT=600s # 10 minutes
16+
- SERVER_WRITE_TIMEOUT=600s # 10 minutes
17+
- SERVER_IDLE_TIMEOUT=120s # 2 minutes
18+
- SERVER_ADDR=0.0.0.0:8080
19+
deploy:
20+
resources:
21+
limits:
22+
memory: 2G
23+
reservations:
24+
memory: 512M
25+
ulimits:
26+
nofile:
27+
soft: 65536
28+
hard: 65536

0 commit comments

Comments
 (0)