Working on building out the compose file for dev/local operations.

Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
2025-08-20 17:13:38 -04:00
parent 932d7b59c0
commit 3a9339fe6d
2 changed files with 76 additions and 9 deletions

66
compose.dev.yml Normal file
View File

@@ -0,0 +1,66 @@
services:
backend:
extends:
file: compose.yml
service: backend
volumes:
- ./backend/src:/app/src
- ./backend/poetry.lock:/app/poetry.lock
- ./backend/pyproject.toml:/app/pyproject.toml
command: ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
security_opt:
- no-new-privileges:true
user: "1000:1000" # Non-root user
frontend:
extends:
file: compose.yml
service: frontend
volumes:
- ./frontend/src:/app/src
- ./frontend/package.json:/app/package.json
- ./frontend/yarn.lock:/app/yarn.lock
command: ["yarn", "start"]
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
security_opt:
- no-new-privileges:true
user: "1000:1000" # Non-root user
postgres:
extends:
file: compose.yml
service: postgres
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
volumes:
postgres-data:
networks:
app-network:
driver: bridge

View File

@@ -1,10 +1,5 @@
FROM node:24.6.0-slim AS base
# Installing npm globally to ensure the latest version is used
RUN npm install --location=global npm@latest
# Build stage
FROM base AS builder
FROM node:24.6.0 AS builder
# Setting working directory for build
WORKDIR /app
@@ -28,15 +23,21 @@ COPY . .
RUN yarn run build
# Production stage
FROM base
FROM node:24.6.0-slim
# Setting working directory
# Setting working directory for build
WORKDIR /app
# Installing serve to run the production build
RUN yarn global add serve
# Copying only the build output from the builder stage
# Copying only the necessary files from the builder stage
# This includes package.json, yarn.lock, tsconfig.json, node_modules, public, and the build output
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/yarn.lock ./
COPY --from=builder /app/tsconfig.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/public ./public
COPY --from=builder /app/build ./build
# Exposing the port the app will run on