repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
eb2019a
parent
f8031ae
author
Eric Bower
date
2025-06-15 08:38:40 -0400 EDT
refactor(pgs): lite -> cdn naming
5 files changed,  +14, -17
R Dockerfile.lite => Dockerfile.cdn
+2, -2
 1@@ -26,13 +26,13 @@ ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}
 2 
 3 RUN --mount=type=cache,target=/go/pkg/,rw \
 4   --mount=type=cache,target=/root/.cache/,rw \
 5-  go build -ldflags "$LDFLAGS" -o /go/bin/pgs-web-lite ./cmd/pgs/lite
 6+  go build -ldflags "$LDFLAGS" -o /go/bin/pgs-cdn ./cmd/pgs/cdn
 7 
 8 FROM scratch AS release-web
 9 
10 WORKDIR /app
11 
12 COPY --from=builder-web /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
13-COPY --from=builder-web /go/bin/pgs-web-lite ./web
14+COPY --from=builder-web /go/bin/pgs-cdn ./web
15 
16 ENTRYPOINT ["/app/web"]
M Makefile
+4, -4
 1@@ -45,9 +45,9 @@ bp-auth: bp-setup
 2 	$(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/auth-web:$(DOCKER_TAG) --build-arg APP=auth --target release-web .
 3 .PHONY: bp-auth
 4 
 5-bp-pgs-lite: bp-setup
 6-	$(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/pgs-web-lite:$(DOCKER_TAG) --target release-web -f Dockerfile.lite .
 7-.PHONY: bp-pgs-lite
 8+bp-pgs-cdn: bp-setup
 9+	$(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/pgs-cdn:$(DOCKER_TAG) --target release-web -f Dockerfile.cdn .
10+.PHONY: bp-pgs-cdn
11 
12 bp-pico: bp-setup
13 	$(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/pico-ssh:$(DOCKER_TAG) --build-arg APP=pico --target release-ssh .
14@@ -66,7 +66,7 @@ bp-%: bp-setup
15 	$(DOCKER_BUILDX_BUILD) --build-arg "APP=$*" -t "ghcr.io/picosh/pico/$*-web:$(DOCKER_TAG)" --target release-web .
16 .PHONY: bp-%
17 
18-bp-all: bp-prose bp-pastes bp-feeds bp-pgs bp-auth bp-bouncer bp-pipe bp-pgs-lite
19+bp-all: bp-prose bp-pastes bp-feeds bp-pgs bp-auth bp-bouncer bp-pipe bp-pgs-cdn
20 .PHONY: bp-all
21 
22 build-auth:
R cmd/pgs/lite/main.go => cmd/pgs/cdn/main.go
+3, -6
 1@@ -17,7 +17,7 @@ import (
 2 )
 3 
 4 func main() {
 5-	logger := shared.CreateLogger("pgs-web-lite")
 6+	logger := shared.CreateLogger("pgs-cdn")
 7 	ctx := context.Background()
 8 	cfg := pgs.NewPgsConfig(logger, nil, nil)
 9 	httpCache := pgs.SetupCache(cfg)
10@@ -69,11 +69,8 @@ func (c *cachedHttp) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
11 
12 func fullURL(r *http.Request) string {
13 	builder := strings.Builder{}
14-	if r.TLS != nil {
15-		builder.WriteString("https://")
16-	} else {
17-		builder.WriteString("http://")
18-	}
19+	// this service sits behind a proxy so we need to force it to https
20+	builder.WriteString("https://")
21 	builder.WriteString(r.Host)
22 	builder.WriteString(r.URL.Path)
23 
M docker-compose.prod.yml
+1, -1
1@@ -243,7 +243,7 @@ services:
2       options:
3         max-file: "3"
4         max-size: "1024m"
5-  pgs-web-lite:
6+  pgs-cdn:
7     dns: 1.1.1.1
8     networks:
9       pgs:
M docker-compose.yml
+4, -4
 1@@ -83,11 +83,11 @@ services:
 2       - pgs
 3       - services
 4       - all
 5-  pgs-web-lite:
 6-    image: ghcr.io/picosh/pico/pgs-web-lite:latest
 7+  pgs-cdn:
 8+    image: ghcr.io/picosh/pico/pgs-cdn:latest
 9     restart: always
10     profiles:
11-      - pgs-lite
12+      - pgs-cdn
13       - services
14       - all
15   pgs-ssh:
16@@ -95,7 +95,7 @@ services:
17     restart: always
18     profiles:
19       - pgs
20-      - pgs-lite
21+      - pgs-cdn
22       - services
23       - all
24   feeds-web: