From 6194678607d853cb944fdff41ce983d9ffa64756 Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Thu, 24 Apr 2025 12:58:25 -0600 Subject: [PATCH] This --- .github/workflows/deploy.yml | 2 ++ Dockerfile | 13 ++++++++++++- docker-compose.yml | 5 +---- fresh.gen.ts | 6 ++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index eee8a2d..686c096 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,6 +30,8 @@ jobs: context: . platforms: linux/amd64,linux/arm64 push: true + cache-from: type=registry,ref=${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:buildcache + cache-to: type=registry,ref=${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:buildcache,mode=max tags: | ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }} ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest diff --git a/Dockerfile b/Dockerfile index f452e89..0173951 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,17 +4,28 @@ WORKDIR /app COPY . . +# Build the Fresh application +RUN deno task build + +# Pre-cache the application dependencies RUN deno cache main.ts FROM denoland/deno:alpine WORKDIR /app +# Copy the Deno cache COPY --from=builder /deno-dir/ /deno-dir/ + +# Copy application code including both static directories COPY --from=builder /app/ /app/ +# Ensure static assets directories permissions are set correctly +RUN chmod -R 755 /app/static /app/_fresh/static + ENV DENO_DEPLOYMENT=production EXPOSE 8000 -CMD ["run", "-A", "main.ts"] +# Run with appropriate flags for static file serving +CMD ["run", "--allow-net", "--allow-read", "--allow-env", "main.ts"] diff --git a/docker-compose.yml b/docker-compose.yml index 7a63353..d39f849 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,4 @@ services: environment: - DENO_DEPLOYMENT=production ports: - - "3000:8000" - # If you need to persist any data - volumes: - - ./data:/app/data \ No newline at end of file + - "3000:8000" \ No newline at end of file diff --git a/fresh.gen.ts b/fresh.gen.ts index 4e56c15..a162a81 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -10,7 +10,7 @@ import * as $index from "./routes/index.tsx"; import * as $post_slug_ from "./routes/post/[slug].tsx"; import * as $posts from "./routes/posts.tsx"; import * as $projects from "./routes/projects.tsx"; - +import * as $Example from "./islands/Example.tsx"; import type { Manifest } from "$fresh/server.ts"; const manifest = { @@ -24,7 +24,9 @@ const manifest = { "./routes/posts.tsx": $posts, "./routes/projects.tsx": $projects, }, - islands: {}, + islands: { + "./islands/Example.tsx": $Example, + }, baseUrl: import.meta.url, } satisfies Manifest;