mirror of
https://github.com/d0zingcat/BroadcastChannel.git
synced 2026-05-31 07:26:54 +00:00
feat: add Docker support and enhance environment configuration
- Introduce .dockerignore for Docker build optimization - Add Dockerfile for containerization setup - Update .env.example to clear Sentry variables and rename HOST to TELEGRAM_HOST - Modify astro.config.mjs to conditionally exclude SSR dependencies in Docker builds - Adjust postinstall script to safely handle missing .git directory - Refactor telegram host retrieval for clarity and consistency
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM node:lts-alpine AS base
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# FROM base AS prod-deps
|
||||
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
|
||||
FROM base AS build-deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
FROM build-deps AS build
|
||||
COPY . .
|
||||
RUN export $(cat .env.example) && export DOCKER=true && pnpm run build
|
||||
|
||||
FROM base AS runtime
|
||||
# COPY --from=prod-deps /app/node_modules ./node_modules
|
||||
COPY --from=build /app/dist ./dist
|
||||
|
||||
ENV HOST=0.0.0.0
|
||||
ENV PORT=4321
|
||||
EXPOSE 4321
|
||||
CMD node ./dist/server/entry.mjs
|
||||
Reference in New Issue
Block a user