Escrevendo, e rodando o que foi escrito
$ hive container main.hive
Wrote Dockerfile for main.hive (0s)
$ docker build -t main .
$ docker run --rm -p 8080:8080 main
O que ele escreve
# syntax=docker/dockerfile:1
#
# Builds and runs main.hive, from nothing but this folder.
#
# docker build -t main .
# docker run --rm -p 8080:8080 main
##############################################################################
# Stage 1 — download Go and the compiler, then build
##############################################################################
FROM debian:bookworm-slim AS builder
# What Docker is building for: amd64 on an ordinary machine, arm64 on an
# Apple-silicon one or a Graviton.
ARG TARGETARCH
# ... Go itself, then the compiler's latest release for that architecture ...
WORKDIR /app
# The whole folder, because a program is its entrypoint and whatever that
# imported. A .dockerignore is what narrows this.
COPY . .
RUN hivec build /app/main.hive \
&& test -x /app/main
##############################################################################
# Stage 2 — runtime
##############################################################################
FROM gcr.io/distroless/static-debian12 AS runtime
WORKDIR /app
COPY --from=builder /app/main /usr/local/bin/main
# 8080 is where this program serves: hive.net.httpServe(8080, ...) says so.
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/main"]