Add Docker image and compose for Needle web exports
Serve production Vite dist with nginx; optional SampleScene profile. Made-with: Cursor
This commit is contained in:
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# Needle Engine web export (Vite) → static nginx
|
||||
#
|
||||
# Prerequisites before `docker build`:
|
||||
# - Export your scene from Unity so Needle/MenuScene (or SampleScene) contains:
|
||||
# - src/generated/ (gen.js, register_types, etc.)
|
||||
# - assets/ with your .glb and any files the Vite build copies
|
||||
# - `npm run build` should succeed locally for the same NEEDLE_APP.
|
||||
#
|
||||
# Build needs network: Needle's build may verify license against needle.tools.
|
||||
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /build
|
||||
|
||||
ARG NEEDLE_APP=MenuScene
|
||||
ENV NEEDLE_APP=${NEEDLE_APP}
|
||||
|
||||
COPY Needle/${NEEDLE_APP}/package.json Needle/${NEEDLE_APP}/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY Needle/${NEEDLE_APP}/ ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27-alpine AS runtime
|
||||
|
||||
COPY --from=build /build/dist /usr/share/nginx/html
|
||||
COPY docker/nginx-default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD wget -q -O /dev/null http://127.0.0.1/ || exit 1
|
||||
Reference in New Issue
Block a user