-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (53 loc) · 1.64 KB
/
Copy pathDockerfile
File metadata and controls
71 lines (53 loc) · 1.64 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
66
67
68
69
70
71
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.9.0 AS xx
# Frontend build
FROM --platform=$BUILDPLATFORM node:24-alpine AS ui-builder
WORKDIR /app
COPY ui/package.json ui/package-lock.json ui/
RUN cd ui && npm ci
COPY locales/ locales/
COPY ui/ ui/
RUN cd ui && npm run build
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS go-base
WORKDIR /app
COPY --from=xx / /
RUN apk add --no-cache git
# Rmapi stage
FROM ghcr.io/ddvk/rmapi:v0.0.35 AS rmapi-binary
# Aviary build
FROM --platform=$BUILDPLATFORM go-base AS aviary-builder
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=ui-builder /app/ui/dist ./ui/dist
# Build args for version injection
ARG VERSION=dev
ARG GIT_COMMIT=unknown
ARG BUILD_DATE=unknown
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/root/.cache \
CGO_ENABLED=0 xx-go build \
-ldflags="-w -s \
-X github.com/rmitchellscott/aviary/internal/version.Version=${VERSION} \
-X github.com/rmitchellscott/aviary/internal/version.GitCommit=${GIT_COMMIT} \
-X github.com/rmitchellscott/aviary/internal/version.BuildDate=${BUILD_DATE}" \
-trimpath
# Final image
FROM alpine:3.23
# Install runtime dependencies
RUN apk add --no-cache \
ca-certificates \
ghostscript \
imagemagick \
postgresql-client \
mupdf-tools \
&& update-ca-certificates
WORKDIR /app
COPY --from=rmapi-binary /usr/local/bin/rmapi /usr/local/bin/
COPY --from=aviary-builder /app/aviary /usr/local/bin/
COPY --from=aviary-builder /app/locales ./locales
ENV PORT=8000 \
PDF_DIR=/app/pdfs \
RM_TARGET_DIR=/ \
GS_COMPAT=1.7 \
GS_SETTINGS=/ebook
ENTRYPOINT ["/usr/local/bin/aviary"]