0bb38a2fb4
ci: add deployment Co-authored-by: sangnn <sangnn.vng@gmail.com> Co-committed-by: sangnn <sangnn.vng@gmail.com>
29 lines
693 B
Docker
29 lines
693 B
Docker
# Build stage
|
|
FROM oven/bun:1-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json bun.lockb* ./
|
|
RUN bun install
|
|
|
|
COPY . .
|
|
ARG VITE_API_BASE_URL=http://localhost:5000/api/v1
|
|
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
|
|
RUN bun run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine AS production
|
|
|
|
# Patch inherited Alpine OS packages to clear known CVEs not yet in the base image
|
|
RUN apk upgrade --no-cache
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:8080 || exit 1
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|