Serve the built SPA from the PHP image; drop the web container
The Dockerfile is now multi-stage: a Node stage runs `npm run build`, and the PHP/Apache stage copies the result into public/. Apache + public/.htaccess route /api* to the Slim front controller, serve real files, and fall back to index.html for client-side routes. docker-compose.yml loses the `web` service, its volume, and the source bind-mount -- the image is the artifact now (rebuild to pick up changes). Frontend dev moves to `npm run dev` on the host; APP_URL defaults to :8080 since the one container serves both halves. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
# Development image: runs the Vite dev server. A production build image is a
|
||||
# later concern.
|
||||
FROM node:24-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies against this image's platform (musl), kept in a volume
|
||||
# by docker-compose so the host's node_modules never shadow them.
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 5173
|
||||
CMD ["npm", "run", "dev"]
|
||||
+2
-2
@@ -2,8 +2,8 @@ import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
// The API the dev server proxies `/api` to. Defaults to the Dockerised API on
|
||||
// the host; the compose `web` service overrides it to the internal address.
|
||||
// Host-only dev server: proxy `/api` to the Dockerised API published on the
|
||||
// host. Override with VITE_PROXY_TARGET if the API runs elsewhere.
|
||||
const proxyTarget = process.env.VITE_PROXY_TARGET ?? 'http://localhost:8080'
|
||||
|
||||
// https://vite.dev/config/
|
||||
|
||||
Reference in New Issue
Block a user