forked from SandeepVashishtha/Eventra
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (25 loc) · 1.08 KB
/
Copy pathDockerfile
File metadata and controls
28 lines (25 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM node:22-alpine AS build
LABEL maintainer="Eventra Community"
WORKDIR /app
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Copy dependency manifests first for Docker layer caching
COPY package.json package-lock.json ./
# Install dependencies with BuildKit cache mount for npm cache persistence
# --mount=type=cache preserves ~/.npm across builds so npm doesn't re-download
# packages that are already cached from previous builds
RUN --mount=type=cache,target=/root/.npm \
npm ci --prefer-offline --no-audit --no-fund --cache /root/.npm
# Copy source code and build
COPY . .
RUN npm run build
FROM nginx:stable-alpine AS serve
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
COPY --from=build /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN chown -R appuser:appgroup /usr/share/nginx/html /etc/nginx/conf.d
USER appuser
RUN apk add --no-cache wget
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
CMD ["nginx", "-g", "daemon off;"]