Compare commits
3 Commits
c3049d3de3
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 31b0ac0d7d | |||
| cd43d8da29 | |||
| 166a2a2831 |
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Build stage
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy go.mod and go.sum first for caching
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the binary with static linking
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static" -X main.APP_VERSION=${APP_VERSION:-latest} -X main.COMMIT_ID=${COMMIT_ID:-undefined}' -o gocv .
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk --no-cache add ca-certificates tzdata
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the binary from builder
|
||||||
|
COPY --from=builder /app/gocv .
|
||||||
|
|
||||||
|
# Copy config file
|
||||||
|
COPY config.yaml .
|
||||||
|
|
||||||
|
# Create directories for content and output
|
||||||
|
RUN mkdir -p /app/content /app/output /app/themes
|
||||||
|
|
||||||
|
# Copy themes
|
||||||
|
COPY --from=builder /app/themes ./themes
|
||||||
|
|
||||||
|
# Expose default port
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Default command runs serve mode
|
||||||
|
ENTRYPOINT ["./gocv"]
|
||||||
|
CMD ["serve"]
|
||||||
7
PLAN.md
7
PLAN.md
@@ -5,7 +5,7 @@
|
|||||||
- [x] Config via `config.yaml` only (no CLI flags).
|
- [x] Config via `config.yaml` only (no CLI flags).
|
||||||
- [x] Hardcoded paths: `./content` (input), `./output` (build artifacts).
|
- [x] Hardcoded paths: `./content` (input), `./output` (build artifacts).
|
||||||
- [x] Modes: `gocv` (CLI), `gocv serve` (Daemon).
|
- [x] Modes: `gocv` (CLI), `gocv serve` (Daemon).
|
||||||
- [ ] Commit at every loop iteration. Do not push. Do not tag.
|
- [x] Commit at every loop iteration. Do not push. Do not tag. (Workflow instruction)
|
||||||
|
|
||||||
## Current Status
|
## Current Status
|
||||||
- [x] Project backbone exists (HTTP server, graceful shutdown, config reading).
|
- [x] Project backbone exists (HTTP server, graceful shutdown, config reading).
|
||||||
@@ -15,14 +15,15 @@
|
|||||||
- [x] CLI Mode (`gocv`) generates static files to `./output` and exits.
|
- [x] CLI Mode (`gocv`) generates static files to `./output` and exits.
|
||||||
- [x] Serve Mode (`gocv serve`) hosts HTML and serves PDF on demand.
|
- [x] Serve Mode (`gocv serve`) hosts HTML and serves PDF on demand.
|
||||||
- [x] File Watcher implemented for live reload in Serve Mode (using fsnotify).
|
- [x] File Watcher implemented for live reload in Serve Mode (using fsnotify).
|
||||||
- [x] Dockerfile created for multi-stage build.
|
- [x] Dockerfile created for multi-stage build (re-created: was missing from repo).
|
||||||
|
- [x] go.mod dependencies corrected (marked direct deps properly).
|
||||||
|
|
||||||
## Active Task
|
## Active Task
|
||||||
- [x] Analyze existing backbone code and integrate Markdown parsing.
|
- [x] Analyze existing backbone code and integrate Markdown parsing.
|
||||||
- [x] Integrate HTML template engine with theme selection.
|
- [x] Integrate HTML template engine with theme selection.
|
||||||
- [x] Implement Serve Mode with file watching for live reload.
|
- [x] Implement Serve Mode with file watching for live reload.
|
||||||
- [x] Create Dockerfile for multi-stage build.
|
- [x] Create Dockerfile for multi-stage build.
|
||||||
- [ ] All tasks complete - project ready for testing.
|
- [x] All tasks complete - project ready for testing.
|
||||||
|
|
||||||
## Known Issues / Blockers
|
## Known Issues / Blockers
|
||||||
- [x] Identify best Pure Go PDF library that supports HTML/CSS (or define CSS subset).
|
- [x] Identify best Pure Go PDF library that supports HTML/CSS (or define CSS subset).
|
||||||
|
|||||||
10
go.mod
10
go.mod
@@ -3,13 +3,11 @@ module git.bjphoster.com/source/go-cv
|
|||||||
go 1.22.2
|
go 1.22.2
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/fsnotify/fsnotify v1.9.0
|
||||||
|
github.com/go-pdf/fpdf v0.9.0
|
||||||
github.com/gorilla/mux v1.8.1
|
github.com/gorilla/mux v1.8.1
|
||||||
|
github.com/yuin/goldmark v1.7.16
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require golang.org/x/sys v0.13.0 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
|
||||||
github.com/go-pdf/fpdf v0.9.0 // indirect
|
|
||||||
github.com/yuin/goldmark v1.7.16 // indirect
|
|
||||||
golang.org/x/sys v0.13.0 // indirect
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ func (s *WebServer) Initialize() {
|
|||||||
}
|
}
|
||||||
s.AppName = "Go Template Container Web Server"
|
s.AppName = "Go Template Container Web Server"
|
||||||
s.Theme = "default"
|
s.Theme = "default"
|
||||||
s.Theme = "default"
|
|
||||||
|
|
||||||
// Attempt to read the config file (try both config.yml and config.yaml)
|
// Attempt to read the config file (try both config.yml and config.yaml)
|
||||||
var configFile []byte
|
var configFile []byte
|
||||||
|
|||||||
Reference in New Issue
Block a user