Files
archie/Dockerfile.archied
T

40 lines
1.5 KiB
Docker

# archied — the archie daemon
# Run via docker compose alongside NATS.
FROM node:24-trixie-slim AS dashboard
WORKDIR /src/ui
RUN corepack enable
COPY ui/package.json ui/pnpm-lock.yaml ui/pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
COPY ui/ ./
RUN pnpm run build
FROM golang:1.27-trixie AS builder
WORKDIR /src
COPY go.mod go.sum ./
# Cache mounts keep modules and compiled packages on the build daemon; without
# them COPY . . makes every commit a cold compile.
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY . .
COPY --from=dashboard /src/ui/dist ./ui/dist
ARG GATEWAY_VERSION=dev
ARG RUNTIME_VERSION=dev
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 go build \
-ldflags "-X github.com/samcharles93/archie-core/internal/buildinfo.Version=${GATEWAY_VERSION} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=container" \
-o /usr/local/bin/archied ./cmd/archied/
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates git && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/archied /usr/local/bin/archied
ARG GATEWAY_VERSION=dev
ARG RUNTIME_VERSION=dev
LABEL org.opencontainers.image.version="${GATEWAY_VERSION}"
LABEL cloud.catlow.archie.runtime-version="${RUNTIME_VERSION}"
ENTRYPOINT ["archied"]