diff --git a/Dockerfile b/Dockerfile index d5ef27c..508dd58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Node Alpine -- multi-arch (amd64 + arm64) -FROM node:lts-alpine +FROM oven/bun:1.3.10-alpine AS builder WORKDIR /app @@ -7,12 +7,6 @@ WORKDIR /app RUN apk add --no-cache wget curl bash RUN apk add --no-cache python3 make g++ && ln -sf python3 /usr/bin/python -# Install Bun -RUN curl -fsSL https://bun.sh/install | bash - -# Add Bun to PATH so it can be used in subsequent steps -ENV PATH="/root/.bun/bin:${PATH}" - # Copy package files first for caching COPY package.json package-lock.json ./ @@ -25,8 +19,14 @@ COPY . . # Build the project (Bun is now available for "bun x neu build") RUN bun run build -# Expose Vite preview port +# Serve with nginx +FROM nginx:1.28.2-alpine + +COPY --from=builder /app/dist /usr/share/nginx/html + +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Expose the nginx port EXPOSE 4173 -# Run the built project -CMD ["bun", "run", "preview", "--", "--host", "0.0.0.0"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml index 02fe95e..bdf5a2c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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:4173/'] interval: 30s timeout: 3s retries: 3 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..9122c6a --- /dev/null +++ b/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 4173; + listen [::]:4173; + + root /usr/share/nginx/html; + index index.html; + + location ~* \.(?:css|js|mjs|map|json|wasm|mp3|flac|wav|ogg|png|jpg|jpeg|svg|webp|ico|gz|br|utf|ttf|woff2?)$ { + try_files $uri =404; + } + + location / { + try_files $uri $uri/ /index.html; + } +}