From 5ddd514fb7a1853351509d142a60d9ec3bae2c35 Mon Sep 17 00:00:00 2001 From: Formsmith Date: Sat, 20 Jun 2026 10:18:54 +0300 Subject: [PATCH] Organize Docker deployment files --- README.md | 11 ++++++----- Dockerfile => deploy/docker/Dockerfile | 2 +- .../docker/Dockerfile.dockerignore | 0 compose.yaml => deploy/docker/compose.yaml | 4 ++-- deploy/{ => docker}/nginx.conf | 0 package.json | 6 ++++-- 6 files changed, 13 insertions(+), 10 deletions(-) rename Dockerfile => deploy/docker/Dockerfile (89%) rename .dockerignore => deploy/docker/Dockerfile.dockerignore (100%) rename compose.yaml => deploy/docker/compose.yaml (69%) rename deploy/{ => docker}/nginx.conf (100%) diff --git a/README.md b/README.md index 3cadbce..3c63286 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Requirements: Build and start SketchForge: ```bash -docker compose up --build -d +npm run docker:up ``` Open it on the server: @@ -96,20 +96,20 @@ http://SERVER_IP:3000/ To use another host port: ```bash -SKETCHFORGE_PORT=8080 docker compose up --build -d +SKETCHFORGE_PORT=8080 npm run docker:up ``` On PowerShell: ```powershell $env:SKETCHFORGE_PORT = "8080" -docker compose up --build -d +npm run docker:up ``` Stop the server with: ```bash -docker compose down +npm run docker:down ``` ### Manual Static Deployment (Advanced) @@ -138,7 +138,7 @@ npm run build Remove-Item Env:STATIC_EXPORT ``` -The deployable files are generated in `apps/web/out`. Configure the web server to serve that directory and fall back to `index.html` for unknown application paths. [`deploy/nginx.conf`](deploy/nginx.conf) is the configuration used by the Docker image and can be adapted for a manual Nginx installation. +The deployable files are generated in `apps/web/out`. Configure the web server to serve that directory and fall back to `index.html` for unknown application paths. [`deploy/docker/nginx.conf`](deploy/docker/nginx.conf) is the configuration used by the Docker image and can be adapted for a manual Nginx installation. The administrator must also open the chosen LAN port in the server firewall and arrange for the web server to start automatically after a reboot. For each SketchForge update, pull the new source, install dependencies, rebuild `apps/web/out`, replace the served files, and reload the web server. @@ -173,6 +173,7 @@ apps/web/src/generated/ Generated Manifold runtime source apps/web/src/lib/ Shared utilities apps/web/public/assets/ Static app images, icons, logos, shape assets docs/media/ README screenshots and demo videos +deploy/docker/ Docker, Compose, and Nginx deployment files .github/ Issue templates and community files ``` diff --git a/Dockerfile b/deploy/docker/Dockerfile similarity index 89% rename from Dockerfile rename to deploy/docker/Dockerfile index 27e53d3..3961eaf 100644 --- a/Dockerfile +++ b/deploy/docker/Dockerfile @@ -15,7 +15,7 @@ RUN npm run build FROM nginx:stable-alpine AS runner -COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf +COPY deploy/docker/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=builder /app/apps/web/out /usr/share/nginx/html EXPOSE 80 diff --git a/.dockerignore b/deploy/docker/Dockerfile.dockerignore similarity index 100% rename from .dockerignore rename to deploy/docker/Dockerfile.dockerignore diff --git a/compose.yaml b/deploy/docker/compose.yaml similarity index 69% rename from compose.yaml rename to deploy/docker/compose.yaml index cca15cf..6911765 100644 --- a/compose.yaml +++ b/deploy/docker/compose.yaml @@ -2,8 +2,8 @@ services: sketchforge: image: sketchforge:local build: - context: . - dockerfile: Dockerfile + context: ../.. + dockerfile: deploy/docker/Dockerfile ports: - "${SKETCHFORGE_PORT:-3000}:80" restart: unless-stopped diff --git a/deploy/nginx.conf b/deploy/docker/nginx.conf similarity index 100% rename from deploy/nginx.conf rename to deploy/docker/nginx.conf diff --git a/package.json b/package.json index 32b764f..42f2166 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,10 @@ "test:watch": "vitest --config tests/vitest.config.ts", "perf": "vitest run --config tests/vitest.perf.config.ts --reporter verbose", "ci": "npm run typecheck && npm run test", - "docker:build": "docker build -t sketchforge:local .", - "docker:run": "docker run --rm -p 3000:80 sketchforge:local" + "docker:build": "docker build -f deploy/docker/Dockerfile -t sketchforge:local .", + "docker:run": "docker run --rm -p 3000:80 sketchforge:local", + "docker:up": "docker compose -f deploy/docker/compose.yaml up --build -d", + "docker:down": "docker compose -f deploy/docker/compose.yaml down" }, "dependencies": { "@tailwindcss/postcss": "^4.1.8",