Skip to content

Commit 9fa9816

Browse files
committed
fix: dockerfile build steps
1 parent 7d57edd commit 9fa9816

5 files changed

Lines changed: 13 additions & 19 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BETTER_STACK_URL=
1+
BETTER_STACK_URL=https://uptime.betterstack.com/api/v1/incoming-webhook/HYqP4eAdUr1q9WFQLdMvetUj
22
CHECK_INTERVAL=10
33
CPU_LIMIT=90
44
MEMORY_LIMIT=90

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BETTER_STACK_URL=
2+
CHECK_INTERVAL=10
3+
CPU_LIMIT=90
4+
MEMORY_LIMIT=90
5+
DISK_LIMIT=85

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

Dockerfile

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,20 @@ FROM golang:1.21-alpine AS builder
22

33
WORKDIR /app
44

5-
# Install build dependencies
65
RUN apk add --no-cache gcc musl-dev
76

8-
# Copy go mod files
9-
COPY go.mod go.sum ./
10-
11-
# Download dependencies
12-
RUN go mod download
13-
14-
# Copy source code
157
COPY . .
168

17-
# Build the application
18-
RUN CGO_ENABLED=1 GOOS=linux go build -a -o monitoring .
9+
RUN go mod download
1910

20-
# Copy the monitoring binary to /usr/local/bin to make it available in PATH
21-
COPY monitoring /usr/local/bin/monitoring
22-
RUN chmod +x /usr/local/bin/monitoring
11+
RUN go build -o monitoring .
2312

24-
# Final stage
25-
FROM alpine:3.19
13+
FROM alpine:3.19 AS final
2614

2715
WORKDIR /app
2816

29-
# Install runtime dependencies
3017
RUN apk add --no-cache ca-certificates
3118

32-
# Copy binary from builder
33-
COPY --from=builder /app/monitoring .
19+
COPY --from=builder /app/monitoring /usr/local/bin/monitoring
20+
21+
RUN chmod +x /usr/local/bin/monitoring

monitoring

6.88 MB
Binary file not shown.

0 commit comments

Comments
 (0)