Commit 57a8c2bca0
57a8c2bca02cb13ec840909c4cbea1acdd31062d
parent: 007be939d6
Verified · cmc
cmc <hello@cleberg.net> · 2026-09-26 00:13 UTC
Add Docker image and compose file
Layout: unified · split
.dockerignore
added
+5
| @@ -0,0 +1,5 @@ |
| 1 | .git |
| 2 | photos |
| 3 | cache |
| 4 | gallery |
| 5 | .superpowers |
Dockerfile
added
+13
| @@ -0,0 +1,13 @@ |
| 1 | FROM golang:1-alpine AS build |
| 2 | WORKDIR /src |
| 3 | COPY go.mod go.sum ./ |
| 4 | RUN go mod download |
| 5 | COPY . . |
| 6 | RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /gallery ./cmd/gallery |
| 7 | |
| 8 | FROM alpine:3 |
| 9 | RUN apk add --no-cache imagemagick imagemagick-jpeg imagemagick-heic imagemagick-webp exiftool |
| 10 | COPY --from=build /gallery /usr/local/bin/gallery |
| 11 | ENV GALLERY_PHOTOS=/photos GALLERY_CACHE=/cache GALLERY_ADDR=:8080 |
| 12 | EXPOSE 8080 |
| 13 | ENTRYPOINT ["gallery"] |
README.org
+11
| @@ -50,3 +50,14 @@ go build -o gallery ./cmd/gallery |
| 50 | 50 | at a directory with the same file names as [[file:internal/web/templates]]. |
| 51 | 51 | |
| 52 | 52 | See [[file:docs/specs/2026-09-25-gallery-design.org][the design spec]]. |
| 53 | |
| 54 | * Deploy |
| 55 | |
| 56 | #+begin_src sh |
| 57 | git clone https://gitbay.org/cmc/gallery.git ~/docker/gallery |
| 58 | cd ~/docker/gallery |
| 59 | GALLERY_PHOTOS_DIR=/path/to/photos docker compose up -d --build |
| 60 | #+end_src |
| 61 | |
| 62 | The container listens on =127.0.0.1:8003=; put a reverse proxy in front of it. |
| 63 | Photos are mounted read-only; derivatives and =meta.json= live in =./cache=. |
compose.yml
added
+12
| @@ -0,0 +1,12 @@ |
| 1 | services: |
| 2 | gallery: |
| 3 | build: . |
| 4 | container_name: gallery |
| 5 | restart: unless-stopped |
| 6 | ports: |
| 7 | - "127.0.0.1:8003:8080" |
| 8 | volumes: |
| 9 | - ${GALLERY_PHOTOS_DIR:-./photos}:/photos:ro |
| 10 | - ./cache:/cache |
| 11 | environment: |
| 12 | GALLERY_TITLE: ${GALLERY_TITLE:-gallery} |