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)
|
# Node Alpine -- multi-arch (amd64 + arm64)
|
||||||
FROM node:lts-alpine
|
FROM node:lts-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
@ -25,8 +25,12 @@ COPY . .
|
||||||
# Build the project (Bun is now available for "bun x neu build")
|
# Build the project (Bun is now available for "bun x neu build")
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
# Expose Vite preview port
|
# Serve with nginx
|
||||||
EXPOSE 4173
|
FROM nginx:alpine
|
||||||
|
|
||||||
# Run the built project
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
CMD ["bun", "run", "preview", "--", "--host", "0.0.0.0"]
|
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# Expose the nginx port
|
||||||
|
EXPOSE 80
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ services:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: monochrome
|
container_name: monochrome
|
||||||
ports:
|
ports:
|
||||||
- '${MONOCHROME_PORT:-3000}:4173'
|
- '${MONOCHROME_PORT:-3000}:80'
|
||||||
environment:
|
environment:
|
||||||
AUTH_ENABLED: ${AUTH_ENABLED:-false}
|
AUTH_ENABLED: ${AUTH_ENABLED:-false}
|
||||||
AUTH_SECRET: ${AUTH_SECRET:-}
|
AUTH_SECRET: ${AUTH_SECRET:-}
|
||||||
|
|
@ -18,7 +18,7 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- monochrome-network
|
- monochrome-network
|
||||||
healthcheck:
|
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
|
interval: 30s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 3
|
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