Files
svg2NameTag-Ren/webapp/Dockerfile

30 lines
680 B
Docker

# Build stage
FROM node:18-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Production stage
FROM nginx:stable-alpine
# Copy the build output
COPY --from=build /app/dist /usr/share/nginx/html
# Custom nginx config to handle WASM and SPA routing
RUN printf "server {\n\
listen 80;\n\
location / {\n\
root /usr/share/nginx/html;\n\
index index.html;\n\
try_files \$uri \$uri/ /index.html;\n\
}\n\
location ~* \\.wasm$ {\n\
root /usr/share/nginx/html;\n\
default_type application/wasm;\n\
}\n\
}" > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]