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 container_name: fastnotes-api
ports: ports:
- "8000:8000" - "8000:8000"
# No volume immutable image
# env_file: .env # set secrets in Coolify UI
ui: ui:
build: 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 container_name: fastnotes-ui
environment:
- VITE_API_URL=http://api:8000
ports: ports:
- "80:80" # Nginx serves on 80 - "80:80"
depends_on: depends_on:
- api - api

View file

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