Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.gitignore
.github
/data
/bin
/vendor
*.db
*.log
6 changes: 3 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
#pull_request:
# branches:
# - main

env:
REGISTRY: ghcr.io
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ webhooktimer
*.exe
*.test
.DS_Store
/data/
*.corrupt-*
39 changes: 12 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
# Build stage
FROM golang:alpine AS builder
FROM golang:1.22-alpine AS builder

WORKDIR /app
WORKDIR /src

# Install build dependencies
RUN apk add --no-cache git
RUN apk add --no-cache ca-certificates

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
COPY go.mod ./
RUN go mod download

# Copy the source from the current directory to the Working Directory inside the container
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/webhooktimer .

# Build the Go app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o webhooktimer .

# Final stage
FROM alpine:latest

RUN apk --no-cache add ca-certificates tzdata

WORKDIR /app
FROM scratch

# Copy the Pre-built binary file from the previous stage
COPY --from=builder /app/webhooktimer .
COPY --from=builder /app/web ./web
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /out/webhooktimer /webhooktimer

# Expose port 8080 to the outside world
EXPOSE 8080
VOLUME ["/data"]

# Environment variables
ENV PORT=8080
ENV DB_PATH=/data/timers.db
ENV STATE_PATH=/data/state.json
ENV TZ=UTC

# Command to run the executable
CMD ["./webhooktimer"]
ENTRYPOINT ["/webhooktimer"]
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ services:
build: .
ports:
- "8080:8080"
environment:
- TZ=UTC
- STATE_PATH=/data/state.json
volumes:
- ./data:/data
restart: unless-stopped
24 changes: 1 addition & 23 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
module webhooktimer

go 1.25.0

require (
github.com/go-chi/chi/v5 v5.2.5
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
modernc.org/sqlite v1.30.0
)

require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
golang.org/x/sys v0.42.0 // indirect
modernc.org/gc/v3 v3.1.2 // indirect
modernc.org/libc v1.70.0 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
modernc.org/strutil v1.2.1 // indirect
modernc.org/token v1.1.0 // indirect
)
go 1.22
57 changes: 0 additions & 57 deletions go.sum

This file was deleted.

196 changes: 0 additions & 196 deletions internal/handlers/handlers.go

This file was deleted.

Loading