Initial commit
This commit is contained in:
38
apps/server/Dockerfile
Normal file
38
apps/server/Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
# ---- Build stage ----
|
||||
FROM node:22-bookworm-slim AS build
|
||||
WORKDIR /app
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates python3 make g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY package.json package-lock.json* ./
|
||||
COPY apps/server/package.json apps/server/
|
||||
COPY apps/web/package.json apps/web/
|
||||
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
||||
COPY . .
|
||||
RUN npm run build -w @adc-retivo/web
|
||||
RUN npm run build -w @adc-retivo/server
|
||||
|
||||
# ---- Prune prod deps ----
|
||||
FROM build AS prod-deps
|
||||
RUN npm prune --omit=dev \
|
||||
&& mkdir -p /app/apps/server/node_modules /app/apps/web/node_modules
|
||||
|
||||
# ---- Runner stage ----
|
||||
FROM node:22-bookworm-slim AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates libchromaprint-tools ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=prod-deps /app/node_modules ./node_modules
|
||||
COPY --from=prod-deps /app/apps/server/node_modules ./apps/server/node_modules
|
||||
COPY package.json ./
|
||||
COPY apps/server/package.json apps/server/
|
||||
COPY apps/web/package.json apps/web/
|
||||
COPY --from=build /app/apps/server/dist ./apps/server/dist
|
||||
COPY --from=build /app/apps/web/dist ./apps/web/dist
|
||||
COPY apps/server/drizzle ./apps/server/drizzle
|
||||
ENV SERVE_WEB_DIST=/app/apps/web/dist
|
||||
WORKDIR /app/apps/server
|
||||
EXPOSE 3000
|
||||
CMD ["node", "dist/index.js"]
|
||||
Reference in New Issue
Block a user