This commit is contained in:
parent
6194678607
commit
a50e73bb55
1 changed files with 15 additions and 8 deletions
23
Dockerfile
23
Dockerfile
|
@ -2,30 +2,37 @@ FROM denoland/deno:alpine AS builder
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies for native modules
|
||||
RUN apk add --no-cache build-base python3
|
||||
|
||||
COPY . .
|
||||
|
||||
# Build the Fresh application
|
||||
RUN deno task build
|
||||
# Create node_modules directory and install dependencies
|
||||
RUN deno cache -r main.ts
|
||||
|
||||
# Pre-cache the application dependencies
|
||||
RUN deno cache main.ts
|
||||
# Pre-cache npm deps with proper node_modules setup
|
||||
RUN deno task npm:init || echo "No npm:init task defined, continuing"
|
||||
|
||||
# Build Fresh application in a more controlled way (without task)
|
||||
RUN deno run -A dev.ts build || deno run -A --unstable-worker-options --node-modules-dir main.ts build
|
||||
|
||||
FROM denoland/deno:alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the Deno cache
|
||||
# Copy the Deno cache and node_modules
|
||||
COPY --from=builder /deno-dir/ /deno-dir/
|
||||
COPY --from=builder /app/node_modules/ /app/node_modules/
|
||||
|
||||
# Copy application code including both static directories
|
||||
# Copy application code
|
||||
COPY --from=builder /app/ /app/
|
||||
|
||||
# Ensure static assets directories permissions are set correctly
|
||||
RUN chmod -R 755 /app/static /app/_fresh/static
|
||||
RUN chmod -R 755 /app/static /app/_fresh
|
||||
|
||||
ENV DENO_DEPLOYMENT=production
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Run with appropriate flags for static file serving
|
||||
CMD ["run", "--allow-net", "--allow-read", "--allow-env", "main.ts"]
|
||||
CMD ["run", "--allow-net", "--allow-read", "--allow-env", "--node-modules-dir", "main.ts"]
|
||||
|
|
Loading…
Add table
Reference in a new issue