serez-apipack
Package a serez-http API into a self-contained Docker image. No Serez Code installation required on the host — only Docker.
Install
sz install serez-apipackQuick start
From the root of your serez-http project (where serez.json lives):
# Build a Docker image tagged name:version from serez.json
sz pack.sz
# Override port or tag
sz pack.sz port=8080 tag=my-api:latestThen run the image:
docker run -p 3000:3000 my-api:1.0.0How it works
serez-apipack reads your serez.json, generates a Dockerfile in the project directory, and runs docker build. The generated image uses a multi-stage build:
# Stage 1 — compile sz from source
FROM rust:1.78-slim AS builder
RUN cargo install --git https://github.com/Sergio3215/serez-code sz
# Stage 2 — lean runtime image
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y socat && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/sz /usr/local/bin/sz
WORKDIR /app
COPY . .
RUN sz install
EXPOSE 3000
CMD sh -c "sz index.sz & sleep 1 && socat TCP-LISTEN:3000,fork,reuseaddr TCP:127.0.0.1:3000"socat as network translator: Serez Code binds its server to 127.0.0.1. Inside Docker, socat listens on 0.0.0.0 and forwards traffic to the app — so Docker port mapping works without touching the language core.
Options
| Option | Default | Description |
|---|---|---|
project= | . | Path to the project directory (where serez.json is) |
port= | 3000 | Port exposed by the container |
tag= | name:version | Docker image tag (from serez.json if omitted) |
serez.json fields
serez-apipack reads name, version, and main from the project manifest:
{
"name": "my-api",
"version": "1.0.0",
"main": "index.sz",
"dependencies": {
"serez-http": "1.0.0"
}
}Notes
serez-apipack is a deploy tool only — it is not imported in your app code. For local development use sz index.sz directly. Docker must be installed and running on the build machine.