Files
cemetery_admin/Dockerfile
2026-01-26 13:25:17 +03:00

46 lines
893 B
Docker

# Build stage
FROM node:20-alpine AS build
WORKDIR /app
# Copy package files
COPY package.json package-lock.json* pnpm-lock.yaml* yarn.lock* .npmrc* ./
# Install dependencies
RUN if [ -f pnpm-lock.yaml ]; then \
npm install -g pnpm && pnpm install; \
elif [ -f yarn.lock ]; then \
npm install -g yarn && yarn install; \
elif [ -f package-lock.json ]; then \
npm ci; \
else \
npm install; \
fi
# Copy source code
COPY . .
# Build the app
RUN if [ -f pnpm-lock.yaml ]; then \
pnpm build; \
elif [ -f yarn.lock ]; then \
yarn build; \
else \
npm run build; \
fi
# Production stage
FROM nginx:1.27-alpine
# Copy built app
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx config
COPY nginx.conf /etc/nginx/nginx.conf
# Expose port
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]