Consolidate CI and deployment workflows
Add a deploy workflow that builds and pushes the Docker image from the server working directory and runs docker compose on main. Trim CI to a focused Node build in an alpine container (apk deps, npm ci, npm run build) and remove the old docker workflow. Simplify Dockerfile to a builder+runtime flow (npm ci, npm prune, copy node_modules) and make docker-compose use the registry image and proxy network.
This commit is contained in:
+6
-17
@@ -1,37 +1,26 @@
|
||||
# Stage 1: Build the Astro app
|
||||
# Stage 1: Build
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies for native modules (e.g. better-sqlite3)
|
||||
# Native module build deps (better-sqlite3)
|
||||
RUN apk add --no-cache python3 make g++
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
RUN npm run build && npm prune --omit=dev
|
||||
|
||||
# Stage 2: Install production dependencies only
|
||||
FROM node:20-alpine AS deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache python3 make g++
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install --omit=dev
|
||||
|
||||
# Stage 3: Runtime image
|
||||
# Stage 2: Runtime
|
||||
FROM node:20-alpine AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Data directory for SQLite database
|
||||
RUN mkdir -p /data
|
||||
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY package*.json ./
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
Reference in New Issue
Block a user