FROM nginx:alpine
# Copy frontend files
COPY index.html /usr/share/nginx/html/
COPY app.js /usr/share/nginx/html/
# Create nginx configuration
RUN echo 'server { \
listen 3000; \
server_name _; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
} \
location /health { \
access_log off; \
return 200 "healthy\n"; \
add_header Content-Type text/plain; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 3000
HEALTHCHECK --interval=10s --timeout=5s --retries=5 \
CMD wget --quiet --tries=1 --spider http://localhost:3000/health || exit 1
CMD ["nginx", "-g", "daemon off;"]