update docker
This commit is contained in:
parent
b15f09e604
commit
a8f66644ad
2 changed files with 10 additions and 33 deletions
36
compose.yaml
36
compose.yaml
|
|
@ -1,40 +1,20 @@
|
||||||
version: "3.9"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
api:
|
api:
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
|
container_name: fastnotes-api
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
volumes:
|
# No volume – immutable image
|
||||||
- ./backend:/app # live‑code sync for reload
|
# env_file: .env # set secrets in Coolify UI
|
||||||
# env_file: .env # optional, keep secrets out of repo
|
|
||||||
# depends_on:
|
|
||||||
# - db # if you have a DB service
|
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend # defaults to Dockerfile (production)
|
||||||
target: builder # use the builder stage for dev
|
container_name: fastnotes-ui
|
||||||
command: npm run build -- --host 0.0.0.0 --port 5173
|
|
||||||
ports:
|
|
||||||
- "5173:5173"
|
|
||||||
volumes:
|
|
||||||
- ./frontend:/app
|
|
||||||
environment:
|
environment:
|
||||||
- VITE_API_URL=http://localhost:8000
|
- VITE_API_URL=http://api:8000
|
||||||
|
ports:
|
||||||
|
- "80:80" # Nginx serves on 80
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- api
|
||||||
|
|
||||||
# Example DB (Postgres) – optional
|
|
||||||
# db:
|
|
||||||
# image: postgres:16-alpine
|
|
||||||
# environment:
|
|
||||||
# POSTGRES_USER: demo
|
|
||||||
# POSTGRES_PASSWORD: demo
|
|
||||||
# POSTGRES_DB: demo
|
|
||||||
# volumes:
|
|
||||||
# - pgdata:/var/lib/postgresql/data
|
|
||||||
|
|
||||||
# volumes:
|
|
||||||
# pgdata:
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
# ==== frontend/Dockerfile (production) ====
|
|
||||||
|
|
||||||
# ---------- Builder ----------
|
# ---------- Builder ----------
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci # clean install, respects lockfile
|
RUN npm ci # install deps (no dev‑dependencies unless you need them)
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build # Vite outputs to ./dist
|
RUN npm run build # Vite creates ./dist
|
||||||
|
|
||||||
# ---------- Runtime ----------
|
# ---------- Runtime ----------
|
||||||
FROM nginx:stable-alpine AS runtime
|
FROM nginx:stable-alpine AS runtime
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue