Add API Server (Go/PocketBase), Web App (Go BFF + Vue), Fly App (Flutter/DJI MSDK), Adobe Plugin, and Docker/Docker AIO deployment configs. Design assets and build artifacts are gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
1.1 KiB
Docker
36 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ---- Stage 1: build the embedded Vue web app ----
|
|
# vite.config.js writes the build to ../server/dist, i.e. /server/dist here,
|
|
# which the Go binary embeds via //go:embed all:dist in server/main.go.
|
|
FROM node:22-alpine AS web
|
|
WORKDIR /web
|
|
COPY web/package.json web/package-lock.json ./
|
|
RUN npm ci
|
|
COPY web/ ./
|
|
RUN npm run build
|
|
|
|
# ---- Stage 2: build the static Go binary (web app embedded) ----
|
|
FROM golang:1.24-alpine AS build
|
|
WORKDIR /src
|
|
COPY server/go.mod server/go.sum ./
|
|
RUN go mod download
|
|
COPY server/ ./
|
|
# Overlay the freshly built web app so //go:embed all:dist picks it up.
|
|
COPY --from=web /server/dist ./dist
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" \
|
|
-o /out/web-app .
|
|
|
|
# ---- Stage 3: minimal runtime ----
|
|
FROM alpine:latest
|
|
RUN apk add --no-cache ca-certificates tzdata \
|
|
&& adduser -D -u 10001 app
|
|
WORKDIR /app
|
|
COPY --from=build /out/web-app ./web-app
|
|
USER app
|
|
# ADDR is the listen address; API_BASE is the API Server this BFF proxies to.
|
|
ENV ADDR=:8090 \
|
|
API_BASE=http://localhost:8080
|
|
EXPOSE 8090
|
|
ENTRYPOINT ["/app/web-app"]
|