first draft of the project
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
# ---- Stage 1: build the frontend ----
|
||||
FROM node:20-bookworm-slim AS frontend-build
|
||||
WORKDIR /app/frontend
|
||||
COPY frontend/package.json ./
|
||||
RUN npm install
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
# ---- Stage 2: backend + runtime ----
|
||||
FROM node:20-bookworm-slim AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
# Native build tools needed to compile better-sqlite3, removed after install
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends python3 build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY backend/package.json ./
|
||||
RUN npm install --omit=dev
|
||||
|
||||
COPY backend/ ./
|
||||
COPY --from=frontend-build /app/backend/public ./public
|
||||
|
||||
RUN apt-get purge -y --auto-remove python3 build-essential 2>/dev/null || true
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
PORT=8080 \
|
||||
DATA_DIR=/data \
|
||||
FETCH_INTERVAL_MINUTES=15
|
||||
|
||||
VOLUME ["/data"]
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s \
|
||||
CMD node -e "fetch('http://localhost:'+ (process.env.PORT||8080) +'/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user