Build types for Git services
How LogiStack builds Git services with BuildKit using a Dockerfile or Railpack, with build variables, secrets, multi-stage targets and example Dockerfiles.
A Git service needs a build type: how LogiStack turns the checked-out repository into an image. Every build runs on BuildKit, which LogiStack runs as a rootless system service. Pick Dockerfile when your repository has one or you want full control, and Railpack when you want LogiStack to detect the language and build it for you.
Choose a build type
You choose it in the Build with field when you create the service, and change it later under Settings › Source and build › Builder.
| In the wizard | In Settings | What it does |
|---|---|---|
| Dockerfile | Dockerfile | Builds your Dockerfile with BuildKit. |
| Railpack (no Dockerfile needed) | Railpack (detect) | Detects the language and framework, and builds an image without a Dockerfile. |
| Static site | Static site | Runs your build script if there is one, then serves the publish folder with Caddy. See Static site. |
How a build runs
- Cloning: the worker checks out the exact commit the trigger named, in the Root directory you set.
- Building: BuildKit builds the image for the target architectures. The log streams to the Deployments tab.
- Pushing: the image is pushed to the default registry as
<registry>/<org>/<service>:<deploymentId>. Tags are immutable and never:latest, so a rollback runs exactly the image it names.
On a single-node server with no registry, the image is loaded straight into the local Docker engine. A swarm with more than one node needs a registry, because every node must pull the image. See Registries.
Dockerfile
Point at the file
- Dockerfile: the path of the file, relative to the Root directory. Default
Dockerfile. - Build context: the folder sent to BuildKit, relative to the Root directory. Default
.. - Target stage (optional): the stage of a multi-stage Dockerfile to build, such as
runtime.
Save and deploy
Select Save, then Deploy. Source and build settings apply from the next deployment.
Example: Node.js app
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN corepack enable && pnpm build
FROM node:22-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/.output ./.output
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]Set Container port to 3000 and, if you want to stop before an extra test stage, Target stage to runtime.
Example: Go API
FROM golang:1.23 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /out/api ./cmd/api
FROM gcr.io/distroless/static-debian12
COPY --from=build /out/api /api
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/api"]The distroless image has no shell, so the HTTP and TCP health checks cannot run in it. With the check set to None, the service deploys without one. To gate rollouts on a real check, give the binary a health flag and set a Command check such as /api -healthcheck. See Images without a shell.
Static site with your own Caddy image
The Static site builder below does this for you. Write it yourself only when you need a custom Caddy configuration.
FROM node:22-alpine AS build
WORKDIR /app
COPY . .
RUN npm ci && npm run build
FROM caddy:2.10-alpine
COPY --from=build /app/dist /usr/share/caddy
EXPOSE 80Set Container port to 80. Caddy serves /usr/share/caddy by default.
Monorepo
For a repository like this, set Root directory to / and Dockerfile to apps/web/Dockerfile, so the build context includes the shared packages:
/
├── apps/web/Dockerfile
├── apps/api/Dockerfile
└── packages/ui/Or set Root directory to /apps/web when the app needs nothing outside its folder. Add Watch paths so only relevant pushes build. See Deploy from Git.
Static site
Static site builds a website that compiles to plain files (Vite, Astro, Docusaurus, Hugo output committed to the repository, a hand-written index.html) and serves it with Caddy. You need no Dockerfile.
Choose the builder
In the new service wizard, choose Static site in Build with. On an existing service, set Builder to Static site under Settings › Source and build.
Set the publish directory
The wizard uses dist. To change it, open Settings › Source and build and set Publish directory to the folder that holds the built files, relative to the Root directory: dist for Vite, build for Create React App and Docusaurus, out for a Next.js static export, public for Hugo, or . for files at the root of the repository.
Set the container port to 80
Caddy listens on port 80 inside the container. Set Container port to 80, then select Save and Deploy.
What the build does:
- If the root directory has a
package.json, it installs dependencies with the package manager your lockfile names:pnpm-lock.yamluses pnpm,yarn.lockuses Yarn,bun.lockorbun.lockbuses Bun,package-lock.jsonusesnpm ci, and no lockfile usesnpm install. Node.js 22 runs the install. - If
package.jsonhas abuildscript, it runs it. - It copies the publish directory into a Caddy image. Caddy compresses responses with zstd or gzip and serves
index.htmlfor any path that matches no file, so the client-side routes of a single-page app work on reload.
Build-time variables reach the build as environment variables: mark a variable Build to use it in your build script, for example VITE_API_URL=https://api.example.com. A variable that is both Build and Secret is mounted for the build step only and never stored in the image. The LOGISTACK_* variables, such as LOGISTACK_COMMIT_SHA, are available too.
Because every unknown path returns index.html, a missing page shows your home page instead of a 404. If you need real 404 pages, use your own Dockerfile as in Static site with your own Caddy image.
Railpack
Railpack inspects the repository, detects its language and framework, and writes a build plan that BuildKit then builds. No Dockerfile is needed.
- Under Settings › Source and build, set Builder to Railpack (detect).
- Set Container port to the port your app listens on. If your app reads its port from
PORT, set aPORTvariable to the same value. - Select Save, then Deploy.
Railpack builds one architecture per image. On a swarm with both amd64 and arm64 servers, Automatic builds BuildKit's own architecture. See Build platforms.
Build-time variables and secrets
A variable reaches the build only when its Build box is checked in the Environment tab.
- A non-secret build variable is passed as a build argument. Declare it with
ARGin the Dockerfile. - A secret build variable is passed as a BuildKit secret, never as an argument, so it doesn't end up in the image history. Mount it in the step that needs it.
ARG NEXT_PUBLIC_SHOP_NAME
RUN --mount=type=secret,id=NPM_TOKEN,env=NPM_TOKEN \
pnpm install --frozen-lockfile
RUN NEXT_PUBLIC_SHOP_NAME="$NEXT_PUBLIC_SHOP_NAME" pnpm buildThe LOGISTACK_* deployment variables, like LOGISTACK_COMMIT_SHA, are also build arguments. BuildKit only hands an argument to a Dockerfile that declares it:
ARG LOGISTACK_COMMIT_SHA
RUN echo "$LOGISTACK_COMMIT_SHA" > /app/REVISIONCommon problems
a multi-node swarm needs a registry: configure one before building: add a registry under Integrations › Registries.BuildKit cannot build linux/arm64: the service targets an architecture BuildKit can't build. Set up emulation, or build for one architecture. See Build platforms.- A build argument is empty: the variable's Build box is not checked, or the Dockerfile has no
ARGfor it. COPYcan't find a file: the Build context doesn't include it. Widen the context or move the Root directory up.
Deploy a Docker image
Run a published Docker image from Docker Hub, GHCR or any registry on LogiStack, with a domain, published ports, bind mounts and release commands.
Deploy an app from a template
Deploy n8n, Plausible and over 500 other self-hosted apps from the LogiStack template catalog, with their databases, volumes and generated secrets.
