Files
babymonitor/frontend/Dockerfile
T
2026-05-17 20:34:52 +02:00

31 lines
745 B
Docker

FROM node:22-alpine AS build
WORKDIR /app
# Copy package files first to leverage Docker cache
COPY package*.json ./
# Install dependencies (including devDependencies for build)
RUN npm install
# Copy the rest of the application source code
COPY . .
# Build the production assets
RUN npm run build
# Stage 2: Production stage
FROM nginx:1.27-alpine
# Copy the built assets from the build stage to Nginx's default HTML directory
COPY --from=build /app/dist /usr/share/nginx/html
# Copy our custom nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80 to allow access to the web application
EXPOSE 80
# Nginx runs in the foreground by default when using its official image
CMD ["nginx", "-g", "daemon off;"]