Files
administracionHospital/Dockerfile
T

49 lines
871 B
Docker

# Stage 1: Build frontend
FROM node:20-alpine AS builder
WORKDIR /build
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Stage 2: App only (no MariaDB)
FROM node:20-alpine
WORKDIR /app
# Install nginx
RUN apk add --no-cache nginx bash
# Copy built frontend to nginx
COPY --from=builder /build/dist /usr/share/nginx/html
# Copy server files
COPY server/package*.json ./server/
RUN cd ./server && npm ci
COPY server/ ./server/
# Copy nginx config
COPY nginx.conf /etc/nginx/http.d/default.conf
# Create directories
RUN mkdir -p /run/nginx
# Copy entrypoint
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
EXPOSE 80 4000
ENV DB_HOST=db
ENV DB_PORT=3306
ENV DB_USER=hospital
ENV DB_PASSWORD=hospital123
ENV DB_NAME=hospital
ENV ADMIN_DNI=00000000
ENV ADMIN_PASSWORD=Admin123!
ENTRYPOINT ["/docker-entrypoint.sh"]