-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.production
55 lines (40 loc) · 1.08 KB
/
Dockerfile.production
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
FROM node:22-slim AS builder
# Set the working directory
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Create necessary directories
RUN mkdir -p src/utils public/images src/content
# Copy key configuration files first
COPY package.json pnpm-lock.yaml* ./
COPY tsconfig.json ./
COPY svelte.config.js ./
COPY astro.config.mjs ./
# Copy source files
COPY src src/
COPY public public/
# Install dependencies using pnpm
RUN pnpm install
# Build the application
ENV NODE_ENV=production
ENV ASTRO_TELEMETRY_DISABLED=1
RUN pnpm run build
# Production image with minimal dependencies
FROM node:22-slim
WORKDIR /app
# Install serve globally for static file serving
RUN npm install -g serve
# Copy only the built static files
COPY --from=builder /app/dist ./dist
# Create necessary directories for volumes if they don't exist
RUN mkdir -p /app/dist/outputs
RUN mkdir -p /app/dist/images
# Set the environment variables
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3000
ENV ASTRO_TELEMETRY_DISABLED=1
# Expose the port
EXPOSE 3000
# Serve static files
CMD ["serve", "-s", "dist", "-l", "3000"]