mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-21 08:40:10 -06:00
* fix: rm w-full from badges * fix: use slate instead of fuchsia for queued * fix: use `date-funs` to parse + display dates * fix: worker styling * debug: redocly * debug: redocly * debug: redocly * debug: redocly * debug: redocly * debug: redocly * feat: direct workflow id getter * fix: dedupe * fix: return workflow type * chore: lint * chore: lint * fix: overflow * fix: include tenant in query for safety
95 lines
2.8 KiB
Docker
95 lines
2.8 KiB
Docker
# Base Go environment
|
|
# -------------------
|
|
FROM golang:1.24-alpine as base
|
|
WORKDIR /hatchet
|
|
|
|
RUN apk update && apk add --no-cache gcc musl-dev git protoc protobuf-dev
|
|
|
|
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
|
|
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
|
|
RUN go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@v2.0.0
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go mod download
|
|
|
|
COPY /api ./api
|
|
COPY /api-contracts ./api-contracts
|
|
COPY /internal ./internal
|
|
COPY /pkg ./pkg
|
|
COPY /hack ./hack
|
|
COPY /cmd ./cmd
|
|
|
|
RUN go generate ./...
|
|
|
|
# OpenAPI bundle environment
|
|
# -------------------------
|
|
FROM node:18-alpine as build-openapi
|
|
WORKDIR /openapi
|
|
|
|
COPY /api-contracts/openapi ./openapi
|
|
|
|
RUN echo '{ \
|
|
"name": "hack-for-redocly-cli-bug", \
|
|
"version": "1.0.0", \
|
|
"dependencies": { \
|
|
"@redocly/cli": "latest" \
|
|
}, \
|
|
"overrides": { \
|
|
"mobx-react": "9.2.0" \
|
|
} \
|
|
}' > package.json && \
|
|
npm install -g npm@8.1 @redocly/cli@latest && \
|
|
npx @redocly/cli@latest bundle ./openapi/openapi.yaml --output ./bin/oas/openapi.yaml --ext yaml && \
|
|
rm package.json
|
|
|
|
# Go build environment
|
|
# --------------------
|
|
FROM base AS build-go
|
|
|
|
ARG VERSION=v0.1.0-alpha.0
|
|
|
|
# can be set to "api", "engine", "admin" or "lite"
|
|
ARG SERVER_TARGET
|
|
|
|
# check if the target is empty or not set to api, engine, lite, or admin
|
|
RUN if [ -z "$SERVER_TARGET" ] || [ "$SERVER_TARGET" != "api" ] && [ "$SERVER_TARGET" != "engine" ] && [ "$SERVER_TARGET" != "admin" ] && [ "$SERVER_TARGET" != "lite" ] && [ "$SERVER_TARGET" != "migrate" ]; then \
|
|
echo "SERVER_TARGET must be set to 'api', 'engine', 'admin', 'lite', or 'migrate'"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
RUN sh ./hack/proto/proto.sh
|
|
|
|
COPY --from=build-openapi /openapi/bin/oas/openapi.yaml ./bin/oas/openapi.yaml
|
|
|
|
# build oapi
|
|
RUN oapi-codegen -config ./api/v1/server/oas/gen/codegen.yaml ./bin/oas/openapi.yaml
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
--mount=type=cache,target=$GOPATH/pkg/mod \
|
|
go build -ldflags="-w -s -X 'main.Version=${VERSION}'" -a -o ./bin/hatchet-${SERVER_TARGET} ./cmd/hatchet-${SERVER_TARGET}
|
|
|
|
# Deployment environment
|
|
# ----------------------
|
|
FROM alpine AS deployment
|
|
|
|
# can be set to "api", "engine", "admin" or "lite"
|
|
ARG SERVER_TARGET=engine
|
|
ENV SERVER_TARGET=${SERVER_TARGET}
|
|
|
|
WORKDIR /hatchet
|
|
|
|
# openssl and bash needed for admin build
|
|
RUN apk update && apk add --no-cache gcc musl-dev openssl bash ca-certificates tzdata
|
|
|
|
COPY --from=build-go /hatchet/bin/hatchet-${SERVER_TARGET} /hatchet/
|
|
|
|
# NOTE: this is just here for backwards compatibility with old migrate images which require the atlas-apply.sh script.
|
|
# This script is just a wrapped for `/hatchet/hatchet-migrate`.
|
|
COPY /hack/db/atlas-apply.sh ./atlas-apply.sh
|
|
RUN chmod +x ./atlas-apply.sh
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["/bin/sh", "-c", "/hatchet/hatchet-${SERVER_TARGET}"]
|