docker updates

This commit is contained in:
Jamitz 2026-01-06 13:28:32 +00:00
parent a8f66644ad
commit e3da8db7c3
2 changed files with 11 additions and 12 deletions

View file

@ -5,16 +5,14 @@ services:
container_name: fastnotes-api
ports:
- "8000:8000"
# No volume immutable image
# env_file: .env # set secrets in Coolify UI
ui:
build:
context: ./frontend # defaults to Dockerfile (production)
context: ./frontend
args:
VITE_API_URL: https://notesapi.fitzythe.dev # Pass as build arg
container_name: fastnotes-ui
environment:
- VITE_API_URL=http://api:8000
ports:
- "80:80" # Nginx serves on 80
- "80:80"
depends_on:
- api

View file

@ -1,17 +1,18 @@
# ---------- Builder ----------
FROM node:20-alpine AS builder
WORKDIR /app
# Accept build argument
ARG VITE_API_URL
ENV VITE_API_URL=$VITE_API_URL
COPY package*.json ./
RUN npm ci # install deps (no devdependencies unless you need them)
RUN npm ci
COPY . .
RUN npm run build # Vite creates ./dist
RUN npm run build
# ---------- Runtime ----------
FROM nginx:stable-alpine AS runtime
# Copy the compiled assets from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]