From 76d1ed84a1d625dd7ba78ca2f49d719fea2a9e8b Mon Sep 17 00:00:00 2001 From: Takumi Akimoto Date: Fri, 1 May 2026 22:21:12 +0900 Subject: [PATCH] Add Dockerfile & build action --- .github/workflows/build.yaml | 46 ++++++++++++++++++++++++++++++++++++ .gitignore | 1 + Dockerfile | 14 +++++++++++ deno.jsonc | 2 ++ deno.lock | 4 +++- islands/SettingsForm.tsx | 2 +- repository/post.ts | 8 +++---- 7 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..d37d186 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,46 @@ +name: Build + +on: + push: + tags: + - "v*.*.*" + +env: + REGISTRY: ghcr.io + +jobs: + build: + runs-on: ubuntu-24.04 + + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v6 + + - uses: docker/setup-buildx-action@v4 + + - uses: docker/login-action@v4 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/metadata-action@v6 + id: meta + with: + images: ${{ env.REGISTRY }}/${{ github.repository }} + tags: | + type=semver,pattern={{version}} + + - uses: docker/build-push-action@v7 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + outputs: type=image,push-by-digest=true,name-canonical=true,push=true + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + GIT_REVISION=${{ github.sha }} diff --git a/.gitignore b/.gitignore index 9a4f06a..77a530a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +_fresh/ traq/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ce887f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ghcr.io/denoland/deno:distroless-2.7.14 + +ARG GIT_REVISION +ENV DENO_DEPLOYMENT_ID=${GIT_REVISION} + +WORKDIR /app + +COPY . . + +RUN deno task build + +EXPOSE 8000 + +CMD ["deno", "serve", "--allow-env", "--allow-net", "_fresh/server/server_entry.mjs"] diff --git a/deno.jsonc b/deno.jsonc index 423c853..10b63ce 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -13,6 +13,7 @@ "@hey-api/openapi-ts": "npm:@hey-api/openapi-ts@^0.97.0", "@hey-api/vite-plugin": "npm:@hey-api/vite-plugin@^0.3.1", "@kysely/kysely": "jsr:@kysely/kysely@^0.28.16", + "@preact/signals": "npm:@preact/signals@^2.9.0", "@skyware/jetstream": "npm:@skyware/jetstream@^0.2.5", "@std/encoding": "jsr:@std/encoding@^1.0.10", "@std/http": "jsr:@std/http@^1.1.0", @@ -31,6 +32,7 @@ } }, "tasks": { + "build": "deno run -A vite build", "dev": "deno run -A vite" }, "unstable": [ diff --git a/deno.lock b/deno.lock index fbc48cd..094f8aa 100644 --- a/deno.lock +++ b/deno.lock @@ -42,6 +42,7 @@ "npm:@hey-api/vite-plugin@~0.3.1": "0.3.1_@hey-api+openapi-ts@0.97.0__typescript@6.0.3_vite@7.3.2__@types+node@25.6.0_typescript@6.0.3", "npm:@opentelemetry/api@^1.9.0": "1.9.1", "npm:@preact/signals@^2.5.1": "2.9.0_preact@10.29.1", + "npm:@preact/signals@^2.9.0": "2.9.0_preact@10.29.1", "npm:@prefresh/vite@^2.4.8": "2.4.12_preact@10.29.1_vite@7.3.2__@types+node@25.6.0_@types+node@25.6.0", "npm:@remix-run/node-fetch-server@0.12": "0.12.0", "npm:@skyware/jetstream@~0.2.5": "0.2.5", @@ -96,7 +97,7 @@ "jsr:@std/semver", "jsr:@std/uuid", "npm:@opentelemetry/api", - "npm:@preact/signals", + "npm:@preact/signals@^2.5.1", "npm:esbuild-wasm", "npm:esbuild@0.25.7", "npm:preact-render-to-string", @@ -1703,6 +1704,7 @@ "npm:@badgateway/oauth2-client@^3.3.1", "npm:@hey-api/openapi-ts@0.97", "npm:@hey-api/vite-plugin@~0.3.1", + "npm:@preact/signals@^2.9.0", "npm:@skyware/jetstream@~0.2.5", "npm:jose@^6.2.3", "npm:mysql2@^3.22.3", diff --git a/islands/SettingsForm.tsx b/islands/SettingsForm.tsx index 194bd5e..922d0c0 100644 --- a/islands/SettingsForm.tsx +++ b/islands/SettingsForm.tsx @@ -1,4 +1,4 @@ -import { useSignal } from "preact/signals" +import { useSignal } from "@preact/signals" interface Props { did: string diff --git a/repository/post.ts b/repository/post.ts index 094632d..6be5e5a 100644 --- a/repository/post.ts +++ b/repository/post.ts @@ -4,9 +4,9 @@ export const getTraqMessageIdByAtProtoUri = async ( atProtoUri: string, ): Promise => { const result = await db.selectFrom("posts") - .select("traqMessageId") - .where("atProtoUri", "=", atProtoUri) - .executeTakeFirst() + .select("traqMessageId") + .where("atProtoUri", "=", atProtoUri) + .executeTakeFirst() return result?.traqMessageId } @@ -19,4 +19,4 @@ export const savePostMetadata = async (data: { atProtoUri: data.atProtoUri, traqMessageId: data.traqMessageId, }).execute() -}) +} -- 2.51.2