Docker
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# Multi-stage Dockerfile for wsmud
|
||||
FROM node:18-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
# copy package and lock first for faster rebuilds
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --omit=dev || npm i --no-audit
|
||||
|
||||
# copy full source and build frontend with vite
|
||||
COPY . .
|
||||
RUN npm run build || true
|
||||
|
||||
FROM node:18-alpine AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
# create folder for logs and db
|
||||
RUN mkdir -p /app/log /app/data /app/www
|
||||
|
||||
# copy node_modules from build stage
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY --from=build /app/www ./www
|
||||
COPY --from=build /app .
|
||||
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["node", "web.js"]
|
||||
Reference in New Issue
Block a user