File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .git
2+ .gitignore
3+ .github
4+ /data
5+ /bin
6+ /vendor
7+ * .db
8+ * .log
Original file line number Diff line number Diff line change 44 push :
55 branches :
66 - main
7- pull_request :
8- branches :
9- - main
7+ # pull_request:
8+ # branches:
9+ # - main
1010
1111env :
1212 REGISTRY : ghcr.io
Original file line number Diff line number Diff line change @@ -6,3 +6,5 @@ webhooktimer
66* .exe
77* .test
88.DS_Store
9+ /data /
10+ * .corrupt- *
Original file line number Diff line number Diff line change 1- # Build stage
2- FROM golang:alpine AS builder
1+ FROM golang:1.22-alpine AS builder
32
4- WORKDIR /app
3+ WORKDIR /src
54
6- # Install build dependencies
7- RUN apk add --no-cache git
5+ RUN apk add --no-cache ca-certificates
86
9- # Copy go mod and sum files
10- COPY go.mod go.sum ./
11-
12- # Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
7+ COPY go.mod ./
138RUN go mod download
149
15- # Copy the source from the current directory to the Working Directory inside the container
1610COPY . .
11+ RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/webhooktimer .
1712
18- # Build the Go app
19- RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o webhooktimer .
20-
21- # Final stage
22- FROM alpine:latest
23-
24- RUN apk --no-cache add ca-certificates tzdata
25-
26- WORKDIR /app
13+ FROM scratch
2714
28- # Copy the Pre-built binary file from the previous stage
29- COPY --from=builder /app/webhooktimer .
30- COPY --from=builder /app/web ./web
15+ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
16+ COPY --from=builder /out/webhooktimer /webhooktimer
3117
32- # Expose port 8080 to the outside world
3318EXPOSE 8080
19+ VOLUME ["/data" ]
3420
35- # Environment variables
3621ENV PORT=8080
37- ENV DB_PATH=/data/timers.db
22+ ENV STATE_PATH=/data/state.json
23+ ENV TZ=UTC
3824
39- # Command to run the executable
40- CMD ["./webhooktimer" ]
25+ ENTRYPOINT ["/webhooktimer" ]
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ services:
33 build : .
44 ports :
55 - " 8080:8080"
6+ environment :
7+ - TZ=UTC
8+ - STATE_PATH=/data/state.json
69 volumes :
710 - ./data:/data
811 restart : unless-stopped
Original file line number Diff line number Diff line change 11module webhooktimer
22
3- go 1.25.0
4-
5- require (
6- github.com/go-chi/chi/v5 v5.2.5
7- github.com/google/uuid v1.6.0
8- github.com/gorilla/websocket v1.5.3
9- modernc.org/sqlite v1.30.0
10- )
11-
12- require (
13- github.com/dustin/go-humanize v1.0.1 // indirect
14- github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
15- github.com/mattn/go-isatty v0.0.20 // indirect
16- github.com/ncruces/go-strftime v1.0.0 // indirect
17- github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
18- golang.org/x/sys v0.42.0 // indirect
19- modernc.org/gc/v3 v3.1.2 // indirect
20- modernc.org/libc v1.70.0 // indirect
21- modernc.org/mathutil v1.7.1 // indirect
22- modernc.org/memory v1.11.0 // indirect
23- modernc.org/strutil v1.2.1 // indirect
24- modernc.org/token v1.1.0 // indirect
25- )
3+ go 1.22
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments