From d360fd7db3c21752eb4ed62a9c80ab40c2df994c Mon Sep 17 00:00:00 2001 From: jzzliu Date: Sat, 7 Nov 2026 20:16:27 -0700 Subject: [PATCH] Package Fieldwork storefront for Docker --- .dockerignore | 4 ++++ Caddyfile | 5 +++++ DOCKER.md | 20 ++++++++++++++++++++ Dockerfile | 3 +++ compose.yaml | 8 ++++++++ 5 files changed, 40 insertions(+) create mode 100644 .dockerignore create mode 100644 Caddyfile create mode 100644 DOCKER.md create mode 100644 Dockerfile create mode 100644 compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2d5502e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +** +!Caddyfile +!dist/ +!dist/** diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..6bcb36a --- /dev/null +++ b/Caddyfile @@ -0,0 +1,5 @@ +:8080 { + root * /srv/fieldwork + encode zstd gzip + file_server +} diff --git a/DOCKER.md b/DOCKER.md new file mode 100644 index 0000000..40bb834 --- /dev/null +++ b/DOCKER.md @@ -0,0 +1,20 @@ +# Fieldwork Supply in Docker + +Run these commands from this directory with Docker Compose available. + +```sh +docker compose up -d --build +``` + +Open [the local storefront](http://127.0.0.1:8088). The service binds to +loopback. To use another local port, set `FIELDWORK_PORT` before running Compose. + +```sh +docker compose ps +docker compose logs storefront +docker compose down +``` + +The image serves the static storefront from `dist/` using Caddy. Rebuild after +changing those files. The cart is stored in the visitor's browser and checkout +simulates an order. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..14bff92 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM caddy:2 +COPY Caddyfile /etc/caddy/Caddyfile +COPY dist/ /srv/fieldwork/ diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..38ef5f8 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,8 @@ +name: fieldwork +services: + storefront: + image: fieldwork-storefront:local + build: . + ports: + - "127.0.0.1:${FIELDWORK_PORT:-8088}:8080" + restart: unless-stopped