-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
81 lines (56 loc) · 1.83 KB
/
Dockerfile
File metadata and controls
81 lines (56 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Multi-stage Dockerfile for local development and production deployment
# Supports deployment to ECS and other container-based infrastructure
# Stage 1: Base image with Deno
FROM denoland/deno:2.6.10 AS base
# Install system dependencies required for build process
RUN apt-get update && apt-get install -y \
curl \
git \
ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Stage 2: Dependencies
FROM base AS deps
# Copy dependency files
COPY deno.json deno.lock ./
# Cache the dependencies
RUN deno install --entrypoint deno.json
# Stage 3: Builder
FROM base AS builder
# Copy dependency files and install
COPY deno.json deno.lock ./
RUN deno install --entrypoint deno.json
# Copy all source files
COPY . .
# Setup environment file if it's not there already
RUN cp --update=none .env.example .env
# Create required directories
RUN mkdir -p build public
# Build the site using the build script
ENV DENO_TLS_CA_STORE=system
RUN deno task build
# Stage 4: Production runtime
FROM denoland/deno:alpine-2.6.10 AS production
WORKDIR /app
# Copy the server script (no external dependencies)
COPY src/docker-server.ts ./
# Copy only the built site
COPY --from=builder /app/_site ./_site
# Expose port for web server
EXPOSE 8000
# Run the static file server using the local script
CMD ["deno", "run", "--allow-net", "--allow-read", "--allow-env", "docker-server.ts"]
# Stage 5: Development
FROM base AS development
WORKDIR /app
# Copy all files for development
COPY . .
# Setup environment file if it's not there already
RUN cp --update=none .env.example .env
# Create required directories
RUN mkdir -p build public
# Expose port for development server
EXPOSE 8000
# Default command for development (can be overridden)
CMD ["deno", "run", "--allow-net", "--allow-read", "--allow-env", "docker-server.ts"]