feat: use nginx instead of vite preview
This commit is contained in:
parent
433f859513
commit
a54f751329
3 changed files with 21 additions and 7 deletions
14
Dockerfile
14
Dockerfile
|
|
@ -1,5 +1,5 @@
|
|||
# Node Alpine -- multi-arch (amd64 + arm64)
|
||||
FROM node:lts-alpine
|
||||
FROM node:lts-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
@ -25,8 +25,12 @@ COPY . .
|
|||
# Build the project (Bun is now available for "bun x neu build")
|
||||
RUN bun run build
|
||||
|
||||
# Expose Vite preview port
|
||||
EXPOSE 4173
|
||||
# Serve with nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
# Run the built project
|
||||
CMD ["bun", "run", "preview", "--", "--host", "0.0.0.0"]
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose the nginx port
|
||||
EXPOSE 80
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ services:
|
|||
dockerfile: Dockerfile
|
||||
container_name: monochrome
|
||||
ports:
|
||||
- '${MONOCHROME_PORT:-3000}:4173'
|
||||
- '${MONOCHROME_PORT:-3000}:80'
|
||||
environment:
|
||||
AUTH_ENABLED: ${AUTH_ENABLED:-false}
|
||||
AUTH_SECRET: ${AUTH_SECRET:-}
|
||||
|
|
@ -18,7 +18,7 @@ services:
|
|||
networks:
|
||||
- monochrome-network
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:4173/health']
|
||||
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:80/']
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
|
|
|
|||
10
nginx.conf
Normal file
10
nginx.conf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue