-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (49 loc) · 1.71 KB
/
Dockerfile
File metadata and controls
72 lines (49 loc) · 1.71 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
72
# this is for building the server (cmd/server/)
FROM --platform=$BUILDPLATFORM oven/bun:alpine AS ui-builder
WORKDIR /src
COPY package.json bun.lock tsconfig*.json ./
COPY dashboard/package.json ./dashboard/
COPY web/package.json ./web/
COPY frontend/package.json ./frontend/
COPY landing/package.json ./landing/
COPY packages/ ./packages/
COPY scripts/ ./scripts/
COPY assets/ ./assets/
RUN bun install --filter "!frontend" --filter "!landing" --frozen-lockfile
COPY dashboard/ ./dashboard/
RUN cd dashboard && bun run build
COPY web/ ./web/
RUN cd web && bun run build
# Native Cross Compilation
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
ARG TARGETOS
ARG TARGETARCH
ARG EMBED_UI=true
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
# get rest of backend code
COPY . .
COPY --from=ui-builder /src/dashboard/dist ./dashboard/dist
COPY --from=ui-builder /src/web/dist ./web/dist
RUN if [ "$EMBED_UI" = "true" ]; then \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -trimpath -ldflags="-s -w" -o /bin/prod/pneuma-server ./cmd/server ; \
else \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -tags no_embed -trimpath -ldflags="-s -w" -o /bin/prod/pneuma-server ./cmd/server ; \
fi
# Emulated (if arch differs from runner) but minimal
FROM alpine:latest
# fpcalc won't be included, but inevitably it will, maybe.
RUN apk add --no-cache \
ca-certificates \
ffmpeg
RUN adduser -D -s /bin/sh pneuma
WORKDIR /app
COPY --from=builder /bin/prod/pneuma-server /usr/local/bin/pneuma-server
ENV PNEUMA_SERVER_HOST=0.0.0.0
ENV PNEUMA_DATA_DIR=/data
RUN mkdir -p /data && chown -R pneuma:pneuma /data
VOLUME ["/data"]
USER pneuma
EXPOSE 8989
ENTRYPOINT ["pneuma-server"]