File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ # Stage 1: Build the Go binary
2+ FROM golang:1.23.1-alpine AS builder
3+
4+ # Install dependencies
5+ RUN apk add --no-cache git
6+
7+ # Set the working directory
8+ WORKDIR /GoAdBlock
9+
10+ # Copy Go modules files and download dependencies
11+ COPY go.mod go.sum ./
12+
13+ # Copy the source code
14+ COPY . .
15+
16+ # Build the Go application
17+ RUN go build -o GoAdBlock ./cmd/server/main.go
18+
19+ # Stage 2: Create a minimal runtime image
20+ FROM alpine:latest
21+
22+ RUN adduser -D goadblock && mkdir /GoAdBlock
23+ # Set the working directory
24+ WORKDIR /GoAdBlock/
25+
26+ # Copy the binary from the builder stage
27+ COPY --from=builder /GoAdBlock/GoAdBlock .
28+
29+ # Set execution permissions
30+ RUN chmod +x GoAdBlock
31+ EXPOSE 8080 53
32+ # Command to run the app
33+ CMD ["./GoAdBlock" ]
Original file line number Diff line number Diff line change 1+ version : " 3"
2+ services :
3+ adgoblock :
4+ build :
5+ context : .
6+ dockerfile : Dockerfile
7+ ports :
8+ - " 53:53"
9+ - " 8080:8080"
You can’t perform that action at this time.
0 commit comments