feat: add Dockerfiles for K3s deployment
Some checks failed
Build & Deploy to K3s / build-and-deploy (push) Failing after 3m34s
Some checks failed
Build & Deploy to K3s / build-and-deploy (push) Failing after 3m34s
Dockerfile.ssr for Astro SSR, Dockerfile.api for Fastify API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9a9519ce29
commit
6782e4d40b
18
.dockerignore
Normal file
18
.dockerignore
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
*.md
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
.astro
|
||||||
|
sanity
|
||||||
|
k8s
|
||||||
|
.gitea
|
||||||
|
migrate-images.mjs
|
||||||
|
seed-sanity.mjs
|
||||||
|
seed-sanity-homepage.mjs
|
||||||
|
clean-duplicates.mjs
|
||||||
15
Dockerfile.api
Normal file
15
Dockerfile.api
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Fastify API — no build step, runs server.mjs directly
|
||||||
|
FROM node:22-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
RUN pnpm install --frozen-lockfile --prod
|
||||||
|
|
||||||
|
COPY server.mjs ./
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["node", "server.mjs"]
|
||||||
25
Dockerfile.ssr
Normal file
25
Dockerfile.ssr
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# --- Stage 1: Build Astro SSR ---
|
||||||
|
FROM node:22-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
|
# --- Stage 2: Runtime ---
|
||||||
|
FROM node:22-alpine AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=build /app/dist ./dist
|
||||||
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
|
COPY --from=build /app/package.json ./
|
||||||
|
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
ENV PORT=4321
|
||||||
|
EXPOSE 4321
|
||||||
|
|
||||||
|
CMD ["node", "dist/server/entry.mjs"]
|
||||||
Loading…
x
Reference in New Issue
Block a user