Files
olons_server/Dockerfile
T

33 lines
871 B
Docker

# ---- Stage 1: build the Vue frontend ----
FROM node:22-alpine AS web-builder
WORKDIR /web
RUN corepack enable
COPY web/package.json web/pnpm-lock.yaml web/pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
COPY web/ ./
ENV VITE_PUBLIC_PATH=/
RUN pnpm run build
# ---- Stage 2: build the Go backend ----
FROM golang:1.26 AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=web-builder /web/dist ./web/dist
RUN CGO_ENABLED=0 GOOS=linux go build -o /out/olons_server ./cmd/olons_server
FROM alpine:3.22
WORKDIR /app
RUN apk add --no-cache tzdata
ENV OLONS_SERVER_CONFIG=/app/configs/olons_server.test.json
COPY --from=builder /out/olons_server /app/olons_server
COPY configs /app/configs
COPY --from=web-builder /web/dist /app/web/dist
ENV OLONS_SERVER_FRONTEND_DIR=/app/web/dist
EXPOSE 6061
ENTRYPOINT ["/app/olons_server"]