Simplify Docker deployment

This commit is contained in:
NeilClack
2026-01-20 14:35:08 -06:00
parent 1f5ab4abb6
commit f1d3a62c21
2 changed files with 27 additions and 44 deletions
+26 -5
View File
@@ -1,7 +1,28 @@
FROM dhi.io/node:23-alpine3.21-dev FROM node:22-alpine AS builder
WORKDIR /usr/src/app
COPY package*.json ./ WORKDIR /app
RUN npm install
# Install dependencies first (better layer caching)
COPY package.json package-lock.json ./
RUN npm ci
# Copy source and build
COPY . . COPY . .
CMD ["npm", "run", "build"] RUN npm run build
# Production image
FROM node:22-alpine
WORKDIR /app
# Only copy what we need for production
COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json ./
COPY --from=builder /app/package-lock.json ./
# Install production dependencies only (including dotenv)
RUN npm ci --omit=dev
EXPOSE 3001
CMD ["node", "-r", "dotenv/config", "build"] CMD ["node", "-r", "dotenv/config", "build"]
-38
View File
@@ -1,38 +0,0 @@
services:
postgres:
image: docker.io/library/postgres:16-alpine
container_name: portal_postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 10s
timeout: 5s
retries: 5
pgadmin:
image: docker.io/dpage/pgadmin4:latest
container_name: portal_pgadmin
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
PGADMIN_CONFIG_SERVER_MODE: "False"
volumes:
- pgadmin_data:/var/lib/pgadmin
ports:
- "5050:80"
depends_on:
postgres:
condition: service_healthy
volumes:
pgdata:
pgadmin_data: