From de169161dc90e69d112ef59e74be21a1035c0df8 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 12 Jun 2026 15:11:51 -0700 Subject: [PATCH] Add dockerfile and workflow --- .dockerignore | 12 +++++++ .gitea/workflows/docker-publish.yml | 52 +++++++++++++++++++++++++++++ Dockerfile | 28 ++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/docker-publish.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3a5137a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +node_modules +dist +.git +.gitignore +*.log +.DS_Store +.vscode +.idea +.claude +Dockerfile +.dockerignore +README.md diff --git a/.gitea/workflows/docker-publish.yml b/.gitea/workflows/docker-publish.yml new file mode 100644 index 0000000..5292b15 --- /dev/null +++ b/.gitea/workflows/docker-publish.yml @@ -0,0 +1,52 @@ +name: Docker + +on: + push: + branches: [master] + +env: + REGISTRY: gitea.coracle.social + IMAGE: coracle/nq + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: hodlbod + password: ${{ secrets.PACKAGE_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE }} + tags: | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64 #,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache,mode=max,image-manifest=true,oci-mediatypes=true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a5baa04 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# syntax=docker/dockerfile:1 + +# ---- Build stage: compile the Vite/SolidJS app to static files ---- +FROM node:24-alpine AS build +WORKDIR /app + +# pnpm ships with Node via corepack; pin to the version that produced pnpm-lock.yaml. +RUN corepack enable && corepack prepare pnpm@10.33.0 --activate + +# Install deps first so this layer is cached unless the manifest/lockfile change. +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile + +# Build (`tsc && vite build` → /app/dist). devDependencies are needed here. +COPY . . +RUN pnpm build + +# ---- Serve stage: static files via `serve` ---- +FROM node:24-alpine AS serve +WORKDIR /app + +# `serve` (what `npx serve` runs) — installed at build time so the image is self-contained. +RUN npm install -g serve@14 + +COPY --from=build /app/dist ./dist + +EXPOSE 3000 +CMD ["serve", "-s", "dist", "-l", "3000"]