-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.react
More file actions
24 lines (18 loc) · 789 Bytes
/
Copy pathDockerfile.react
File metadata and controls
24 lines (18 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# syntax=docker/dockerfile:1
# React UI. Serve the Vite build with nginx and proxy /api to the API service.
# nginx.conf must listen on port 80 to match the compose mapping 8081:80.
FROM node:22-alpine AS build
WORKDIR /web
COPY src/HackerNews.BestStories.React/package.json \
src/HackerNews.BestStories.React/package-lock.json \
./
RUN --mount=type=cache,id=npm,target=/root/.npm \
npm ci
COPY src/HackerNews.BestStories.React/ ./
RUN npm run build
FROM nginx:1.30-alpine AS final
COPY src/HackerNews.BestStories.React/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /web/dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=5 \
CMD wget -qO- http://127.0.0.1/health | grep -q "^Healthy$" || exit 1