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
2photos
3cache
4gallery
5.superpowers
Dockerfile added +13
@@ -0,0 +1,13 @@
1FROM golang:1-alpine AS build
2WORKDIR /src
3COPY go.mod go.sum ./
4RUN go mod download
5COPY . .
6RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /gallery ./cmd/gallery
7
8FROM alpine:3
9RUN apk add --no-cache imagemagick imagemagick-jpeg imagemagick-heic imagemagick-webp exiftool
10COPY --from=build /gallery /usr/local/bin/gallery
11ENV GALLERY_PHOTOS=/photos GALLERY_CACHE=/cache GALLERY_ADDR=:8080
12EXPOSE 8080
13ENTRYPOINT ["gallery"]
README.org +11
@@ -50,3 +50,14 @@ go build -o gallery ./cmd/gallery
5050at a directory with the same file names as [[file:internal/web/templates]].
5151
5252See [[file:docs/specs/2026-09-25-gallery-design.org][the design spec]].
53
54* Deploy
55
56#+begin_src sh
57git clone https://gitbay.org/cmc/gallery.git ~/docker/gallery
58cd ~/docker/gallery
59GALLERY_PHOTOS_DIR=/path/to/photos docker compose up -d --build
60#+end_src
61
62The container listens on =127.0.0.1:8003=; put a reverse proxy in front of it.
63Photos are mounted read-only; derivatives and =meta.json= live in =./cache=.
compose.yml added +12
@@ -0,0 +1,12 @@
1services:
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}