Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (33 loc) · 1.63 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (33 loc) · 1.63 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
# Step 1: Frontend
FROM node:26-alpine@sha256:725aeba2364a9b16beae49e180d83bd597dbd0b15c47f1f28875c290bfd255b9 AS frontend-build
WORKDIR /app
ARG APP_VERSION
COPY ./ui/leafwiki-ui/package*.json ./
RUN npm ci --ignore-scripts
COPY ./ui/leafwiki-ui/ ./
RUN VITE_API_URL=/ APP_VERSION=${APP_VERSION} npm run build
# Step 2: Backend + Build binary
FROM golang:1.26-alpine@sha256:3ad57304ad93bbec8548a0437ad9e06a455660655d9af011d58b993f6f615648 AS backend-build
WORKDIR /app
ARG DISABLE_REFRESH_TOKEN_RATE_LIMIT=false
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=frontend-build /app/dist ./internal/http/dist
RUN CGO_ENABLED=0 go build \
-ldflags="-s -w -X github.com/perber/wiki/internal/http.EmbedFrontend=true -X github.com/perber/wiki/internal/http.Environment=production -X github.com/perber/wiki/internal/wiki/auth.DisableRefreshTokenRateLimit=${DISABLE_REFRESH_TOKEN_RATE_LIMIT}" \
-o /out/leafwiki ./cmd/leafwiki
# Step 3: Final image (small)
FROM alpine:3.24@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b AS final
WORKDIR /app
COPY --from=backend-build /out/leafwiki /app/leafwiki
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
EXPOSE 8080
RUN mkdir -p /app/data && chmod 777 /app/data
LABEL org.opencontainers.image.title="LeafWiki" \
org.opencontainers.image.description="LeafWiki – A fast wiki for people who think in folders, not feeds" \
org.opencontainers.image.url="https://demo.leafwiki.com" \
org.opencontainers.image.source="https://github.com/perber/leafwiki" \
org.opencontainers.image.licenses="MIT"
ENTRYPOINT ["/docker-entrypoint.sh"]