-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (46 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
55 lines (46 loc) · 1.26 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
FROM node:24-slim AS base
WORKDIR /app
COPY package.json package-lock.json ./
FROM base AS prod-deps
RUN npm ci --omit=dev
# Remove a bunch of unnecessary stuff to slim down the image
RUN rm -rf \
/app/node_modules/@astrojs/cloudflare \
/app/node_modules/typescript \
/app/node_modules/@shikijs \
/app/node_modules/@esbuild \
/app/node_modules/@cloudflare \
/app/node_modules/fontkit \
/app/node_modules/@babel \
/app/node_modules/prismjs \
/app/node_modules/shiki \
/app/node_modules/rollup \
/app/node_modules/vite \
/app/node_modules/@types \
/app/node_modules/terser \
/app/node_modules/@rollup \
/app/node_modules/esbuild \
/app/node_modules/sharp \
/app/node_modules/@img \
/app/node_modules/astro
FROM base AS build-deps
RUN npm ci
FROM build-deps AS builder
COPY astro.config.mjs tsconfig.json ./
COPY .astro ./
COPY src ./src
COPY build ./build
COPY public ./public
ENV BUILD_ENV=docker
RUN npm run build
RUN npm run astrobuild
# Final Image
FROM gcr.io/distroless/nodejs24-debian12 AS final
WORKDIR /app
COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=4321
EXPOSE 4321
CMD ["/app/dist/server/entry.mjs"]