Multi-stage Dockerfile builds the email-builder, admin frontend, and Go backend from source and stuffs assets into the binary. The runtime-only image moved to Dockerfile.goreleaser for release builds. Adds a Coolify compose file with magic service variables, healthchecks, and volumes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+48
-1
@@ -1,3 +1,50 @@
|
||||
# Self-contained build for EagleCast. Builds the email-builder and admin
|
||||
# frontend, compiles the Go backend, and stuffs all static assets into a
|
||||
# single binary. Used by PaaS platforms like Coolify that build from git.
|
||||
# (Release builds via goreleaser use Dockerfile.goreleaser instead.)
|
||||
|
||||
ARG APP_VERSION=v1.0.0
|
||||
|
||||
# ---- email-builder (React) ----
|
||||
FROM node:22-alpine AS email-builder
|
||||
WORKDIR /build/email-builder
|
||||
COPY frontend/email-builder/package.json frontend/email-builder/yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
COPY frontend/email-builder/ ./
|
||||
RUN yarn build
|
||||
|
||||
# ---- admin frontend (Vue) ----
|
||||
FROM node:22-alpine AS frontend
|
||||
ARG APP_VERSION
|
||||
WORKDIR /build/frontend
|
||||
COPY frontend/package.json frontend/yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
COPY frontend/ ./
|
||||
COPY --from=email-builder /build/email-builder/dist ./public/static/email-builder
|
||||
ENV VUE_APP_VERSION=${APP_VERSION}
|
||||
RUN yarn build
|
||||
|
||||
# ---- backend (Go) ----
|
||||
FROM golang:1.26-alpine AS backend
|
||||
ARG APP_VERSION
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
RUN go install github.com/knadh/stuffbin/...@latest
|
||||
COPY . .
|
||||
COPY --from=frontend /build/frontend/dist ./frontend/dist
|
||||
RUN CGO_ENABLED=0 go build -o eaglecast \
|
||||
-ldflags="-s -w -X 'main.buildString=${APP_VERSION} (docker)' -X 'main.versionString=${APP_VERSION}'" \
|
||||
./cmd
|
||||
RUN /go/bin/stuffbin -a stuff -in eaglecast -out eaglecast \
|
||||
config.toml.sample \
|
||||
schema.sql queries:/queries permissions.json \
|
||||
static/public:/public \
|
||||
static/email-templates \
|
||||
frontend/dist:/admin \
|
||||
i18n:/i18n
|
||||
|
||||
# ---- runtime ----
|
||||
FROM alpine:latest
|
||||
|
||||
# Install dependencies
|
||||
@@ -7,7 +54,7 @@ RUN apk --no-cache add ca-certificates tzdata shadow su-exec
|
||||
WORKDIR /eaglecast
|
||||
|
||||
# Copy only the necessary files
|
||||
COPY eaglecast .
|
||||
COPY --from=backend /build/eaglecast .
|
||||
COPY config.toml.sample config.toml
|
||||
|
||||
# Copy the entrypoint script
|
||||
|
||||
Reference in New Issue
Block a user