forked from coollabsio/coolify-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (51 loc) · 1.93 KB
/
Dockerfile
File metadata and controls
65 lines (51 loc) · 1.93 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Stage 1: Build Stage (oven/bun:1.3.6-alpine)
FROM oven/bun:1.3.6-alpine AS builder
ARG VITE_ANALYTICS_DOMAIN=coolify.io/docs
ARG VITE_SITE_URL=https://coolify.io/docs/
ARG VITE_KORREKTLY_API_TOKEN
ARG VITE_KORREKTLY_BASE_URL
ARG VITE_KORREKTLY_DATASET_ID
ENV VITE_ANALYTICS_DOMAIN=${VITE_ANALYTICS_DOMAIN}
ENV VITE_SITE_URL=${VITE_SITE_URL}
ENV VITE_KORREKTLY_API_TOKEN=${VITE_KORREKTLY_API_TOKEN}
ENV VITE_KORREKTLY_BASE_URL=${VITE_KORREKTLY_BASE_URL}
ENV VITE_KORREKTLY_DATASET_ID=${VITE_KORREKTLY_DATASET_ID}
RUN apk add --no-cache nodejs npm
# Set working directory and copy necessary files
WORKDIR /app
# Copy package files first for better caching
COPY package.json bun.lock ./
# Install Git and dependencies
RUN --mount=type=cache,target=/var/cache/apk \
apk update && apk add --no-cache git
# Install dependencies with cache
RUN --mount=type=cache,target=/root/.bun \
--mount=type=cache,target=/root/.cache/bun \
bun install
# Copy only necessary files for build
COPY docs/ ./docs/
COPY nginx/ ./nginx/
COPY tailwind.config.js .
COPY env.d.ts .
COPY tsconfig*.json ./
# Copy git history for lastUpdated timestamps
COPY .git/ ./.git/
# Build with cache
RUN --mount=type=cache,target=/root/.bun \
--mount=type=cache,target=/root/.cache/bun \
--mount=type=cache,target=/app/docs/.vitepress/.cache \
--mount=type=cache,target=/app/docs/.vitepress/cache \
bun run build
# Stage 2: NGINX Unprivileged Setup (1.29.3-alpine-slim, ARM64)
FROM nginxinc/nginx-unprivileged:1.29.3-alpine-slim AS final
# Set working directory for NGINX and copy built files from the build stage
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/docs/.vitepress/dist /usr/share/nginx/html/docs
# Copy custom NGINX configuration
COPY nginx/nginx.conf /etc/nginx/nginx.conf
# Copy custom redirects NGINX configuration
COPY nginx/redirects.conf /etc/nginx/conf.d/redirects.conf
# Expose port 80
EXPOSE 80
# Start NGINX
CMD ["nginx", "-g", "daemon off;"]