readysite / hosting / Dockerfile
850 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 hosting/ hosting/

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

# Runner Image
FROM debian:bookworm-slim

# Install Node.js for esbuild runtime bundling, and SSH client for Pro server setup
RUN apt-get update && apt-get install -y curl openssh-client && \
    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=8080
ENV ENV=production
EXPOSE 8080

WORKDIR /app

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

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

CMD ["hosting"]
← Back