readysite / website / Dockerfile
798 B
Dockerfile
# Builder Image (needs CGO for libsql)
FROM golang:1.24-bookworm AS builder

WORKDIR /src

COPY go.mod go.sum ./
RUN go mod download

COPY pkg/ pkg/
COPY website/ website/

WORKDIR /src
RUN go build -o /bin/website ./website

# Runner Image
FROM debian:bookworm-slim

# Install Node.js for esbuild runtime bundling
RUN apt-get update && apt-get install -y curl && \
    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

ENV PORT=5000
ENV ENV=production
EXPOSE 5000

WORKDIR /app

# Copy binary
COPY --from=builder /bin/website /usr/local/bin/website

# Copy frontend source for runtime bundling
COPY website/frontend/ frontend/
COPY website/package.json package.json
RUN npm install

CMD ["website"]
← Back