frontend docker refactor

This commit is contained in:
fred 2026-01-28 13:17:57 -08:00
parent 63e33a45b4
commit 8c7fb8c6bf
8 changed files with 30 additions and 30 deletions

13
frontend/Caddyfile Normal file
View file

@ -0,0 +1,13 @@
:80 {
# Backend
handle /api/* {
reverse_proxy recipes_backend:3000
}
# Frontend
handle {
root * /srv/
try_files {path} /index.html
file_server
}
}

View file

@ -1,13 +1,15 @@
FROM node:22-alpine
FROM node:22-alpine AS builder
WORKDIR /usr/src/app
WORKDIR /app
COPY package*.json tsconfig*.json postcss.config.js tailwind.config.js eslint.config.js vite.config.ts index.html ./
COPY src ./src
COPY package*.json ./
RUN apk update && apk upgrade
RUN npm install
RUN npm run build
RUN if [ "$NODE_ENV" = "dev" ]; then npm install; else npm install --omit=dev; fi
COPY . .
FROM caddy:2.10
COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=builder /app/dist /srv
EXPOSE 80
CMD npm run $NODE_ENV

View file

@ -6,8 +6,6 @@ COPY package*.json ./
RUN npm install;
COPY . .
EXPOSE 80
CMD npm run dev
CMD ["npm", "run", "dev"]

View file

@ -5,9 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite --host 0.0.0.0 --port 80",
"production": "npx tsc -b && vite build",
"ci": "tsc -b && vite build",
"lint": "eslint ."
"build": "tsc -b && vite build"
},
"dependencies": {
"react": "^19.1.0",